home *** CD-ROM | disk | FTP | other *** search
/ PC Media 22 / PC MEDIA CD22.iso / share / prog / spm220e / star_ref.doc < prev    next >
Encoding:
Text File  |  1995-10-09  |  205.6 KB  |  3,833 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.               S E R I A L     P O R T S     M A N A G E R     v 2.20
  19.               ------------------------------------------------------
  20.                 S.T.A.R.COMM     Serial Turbo Async. Resident COMMs
  21.               ------------------------------------------------------
  22.                                                             10/08/95
  23.  
  24.               ══════════════(C)opyRight HETRU 1991-1995═════════════
  25.                          13, chemin de la croix St Vincent
  26.                            94430 CHENNEVIERES SUR MARNE
  27.                                       FRANCE
  28.                              tel: (16-1) 45-93-27-38
  29.  
  30.                          CompuServe address: 100414,1524
  31.                        Internet: 100414.1524@Compuserve.com
  32.  
  33.  
  34.  
  35.                       R E F E R E N C E     M A N U A L
  36.  
  37.  
  38.  
  39.  
  40.  
  41.       This document exposes to the programmers the different ways to access
  42.       to the communication functions offered by the STARCOMM driver (that is
  43.       about the interrupt 14h when loaded as a BIOS T.S.R.; about the
  44.       interrupt 21h when loaded by the CONFIG.SYS, i.e. as a DEVICE DRIVER;
  45.       or, finally, about the call by "INT 14h" or "SCL_servs" if the driver
  46.       is used under its "library" format with SCLIB.OBJ).
  47.  
  48.       A description of the C functions and the PASCAL procedures associated
  49.       to this driver is thereby added.
  50.  
  51.       Note that STARCOMM.EXE could be replaced with STARCOM8.EXE in all
  52.       the present document (STARCOMM manages up to 4 serial ports whereas
  53.       STARCOM8 can manages up to 8 of them at the same time...).
  54.  
  55.                                                                         i
  56.  
  57.                              TABLE OF CONTENTS
  58.  
  59.   I- INTERFACING, for the PROGRAMMERS, from the INT 14h:
  60.  
  61.       1- Direct access to the driver:
  62.  
  63.         Normalized BIOS functions:
  64.           Function 00h: BIOS initialization............................ 2
  65.           Function 01h: BIOS writing................................... 2
  66.           Function 02h: BIOS reading................................... 2
  67.           Function 03h: BIOS control signals status.................... 3
  68.           Function 04h: BIOS extended initialization (PS/2 type)....... 4
  69.           Function 05h: BIOS control on modem register (PS/2 type)..... 5
  70.  
  71.         Initialization functions:
  72.           Function 06h: Version of STARCOMM............................ 6
  73.           Function 07h: Opening/closing/status of a port............... 6
  74.           Function 08h: Changing the active port....................... 6
  75.           Function 09h: Controlling the physical parameters of a port.. 7
  76.           Function 0Ah: Controlling the authorization of ports access
  77.                         and the locking of the comm speed and format... 8
  78.           Function 0Bh: Initialization of the communication format..... 9
  79.           Function 0Ch: Reading the used comm-format of a port......... 10
  80.           Function 0Dh: Asking informations on a port buffers.......... 10
  81.           Function 0Eh: Flushing the two buffers of a port............. 10
  82.           Function 0Fh: Flushing the receive buffer of a port.......... 10
  83.           Function 10h: Flushing the transmit buffer of a port......... 11
  84.           Function 11h: Receive and send time-out definitions.......... 11
  85.           Function 12h: Status of the substitution process ?........... 11
  86.           Function 13h: Setting the substitution process............... 12
  87.  
  88.         Input/output of byte(s) on the line(s) (using buffers):
  89.           Function 14h: Reading of N bytes (with expectation).......... 13
  90.           Function 15h: Writing of N bytes (with expectation).......... 13
  91.           Function 16h: 1 byte Reading (without expectation)........... 14
  92.           Function 17h: 1 byte Writing (without expectation)........... 14
  93.           Function 18h: 1 byte Reading, NOT destructive................ 14
  94.           Function 19h: 1 byte Writing in the receive buffer........... 15
  95.           Function 1Ah: Writing of a control string.................... 15
  96.  
  97.         Input/output Controls:
  98.           Function 1Bh: Expecting the transmit buffer to get empty..... 16
  99.           Function 1Ch: Status of the receive buffer ?................. 16
  100.           Function 1Dh: Status of the transmit buffer ?................ 16
  101.           Function 1Eh: Sending a BREAK signal......................... 17
  102.           Function 1Fh: Reading the errors numbers and types........... 18
  103.           Function 20h: Checking the modem status signals.............. 19
  104.           Function 21h: Status of the hardware hand-shaking ?.......... 20
  105.           Function 22h: Seting the hardware hand-shaking............... 20
  106.           Function 23h: Status of the Xon/Xoff hand-shaking............ 20
  107.           Function 24h: Seting the Xon/Xoff hand-shaking............... 21
  108.  
  109.         Special commands to manage the way STARCOMM is working:
  110.           Function 25h: Reading the crucial section flag............... 22
  111.           Function 26h: Installation of a user function................ 22
  112.           Function 27h: Deactivation of the user function.............. 23
  113.           Function 28h: Installation of an Int 14h error handler....... 23
  114.           Function 29h: Deactivation of the error handler.............. 23
  115.           Function 2Ah: Setting the STARCOMM locking in memory......... 24
  116.           Function 2Bh: Is STARCOMM loaded as a DEVICE DRIVER ?........ 25
  117.           Function 2Ch: Seting the port used by the DEVICE DRIVER...... 25
  118.           Function 2Dh: Seting the BIOS emulator....................... 26
  119.           Function 2Eh: Checking the computer hardware type............ 26
  120.  
  121.                                                                        ii
  122.  
  123.  
  124.  
  125.  
  126.  
  127.       2- Procedures interfacing for TURBO PASCAL and TURBO-C:
  128.  
  129.           - Global variables........................................... 27
  130.           - Available procedures and functions......................... 29
  131.  
  132.       3- Description of the PASCAL procedures:
  133.  
  134.           Check_STARCOMM_Present....................................... 32
  135.           Version...................................................... 32
  136.           Open_Port and OpenPort_Buff.................................. 32
  137.           Close_Port................................................... 32
  138.           Port_Opened.................................................. 32
  139.           Interdit_Port................................................ 32
  140.           Autorise_Port................................................ 32
  141.           EtatVerrouilleComm et VerrouilleComm......................... 33
  142.           SLOW_Ems..................................................... 33
  143.           FAST_Ems..................................................... 33
  144.           Send_SLOW.................................................... 33
  145.           Get_Ports_Adresses........................................... 33
  146.           Infos_Uart................................................... 33
  147.           Set_New_Uart................................................. 33
  148.           Infos_Buffs.................................................. 33
  149.           Init_Port.................................................... 34
  150.           Init_status.................................................. 34
  151.           Reset_Init_Status............................................ 34
  152.           Flush_buffers................................................ 34
  153.           Flush_InBuff................................................. 34
  154.           Flush_OutBuff................................................ 34
  155.           ResetCOM_and_TimMAX.......................................... 34
  156.           Change_com_port.............................................. 35
  157.           Attend_Buff_ems_vide......................................... 35
  158.           CheckBufferIn................................................ 35
  159.           CheckBufferOut............................................... 35
  160.           ReadSerie.................................................... 35
  161.           WriteSerie................................................... 35
  162.           ReadCarSerie................................................. 35
  163.           WriteCarSerie................................................ 35
  164.           Peek_rcp..................................................... 36
  165.           Poke_rcp..................................................... 36
  166.           WriteCmde.................................................... 36
  167.           Status_Trait_Erreurs......................................... 36
  168.           Def_Trait_Erreurs............................................ 36
  169.           Etat_du_Modem................................................ 36
  170.           set_DTR...................................................... 36
  171.           clear_DTR.................................................... 36
  172.           set_RTS...................................................... 37
  173.           clear_RTS.................................................... 37
  174.           set_OUT1..................................................... 37
  175.           clear_OUT1................................................... 37
  176.           Send_break................................................... 37
  177.           Errors_Report................................................ 37
  178.           Port_Free.................................................... 37
  179.           HandShake_Status............................................. 37
  180.           HandShake_setup.............................................. 37
  181.           XonoffShaking_Status......................................... 37
  182.           XonoffShaking_setup.......................................... 38
  183.           Set_routine.................................................. 38
  184.           Reset_routine................................................ 38
  185.           Unset_routine................................................ 38
  186.  
  187.                                                                       iii
  188.  
  189.  
  190.           Set_err_routine.............................................. 38
  191.           Reset_err_routine............................................ 38
  192.           Unset_err_routine............................................ 38
  193.           Verrouille................................................... 38
  194.           Deverrouille................................................. 38
  195.           GetPortName.................................................. 39
  196.           GetPortDevice................................................ 39
  197.           ResetPortDevice.............................................. 39
  198.           EmulBIOS..................................................... 39
  199.           SetEmulBIOS.................................................. 39
  200.           OrdiType..................................................... 39
  201.           SetOrdiType.................................................. 39
  202.  
  203.       4- Description of the C procedures:
  204.  
  205.           Check_STARCOMM_Present....................................... 40
  206.           Version...................................................... 40
  207.           Open_Port et OpenPort_Buff................................... 40
  208.           Close_Port................................................... 40
  209.           Port_Opened.................................................. 40
  210.           Interdit_Port................................................ 40
  211.           Autorise_Port................................................ 41
  212.           EtatVerrouilleComm et VerrouilleComm......................... 41
  213.           SLOW_Ems..................................................... 41
  214.           FAST_Ems..................................................... 41
  215.           Send_SLOW.................................................... 41
  216.           Get_Ports_Adresses........................................... 41
  217.           Infos_Uart................................................... 41
  218.           Set_New_Uart................................................. 42
  219.           Infos_Buffs.................................................. 42
  220.           Init_Port.................................................... 42
  221.           Init_status.................................................. 42
  222.           Reset_Init_Status............................................ 42
  223.           Flush_buffers................................................ 42
  224.           Flush_InBuff................................................. 42
  225.           Flush_OutBuff................................................ 43
  226.           ResetCOM_and_TimMAX.......................................... 43
  227.           Change_com_port.............................................. 43
  228.           Attend_Buff_ems_vide......................................... 43
  229.           CheckBufferIn................................................ 43
  230.           CheckBufferOut............................................... 43
  231.           ReadSerie.................................................... 44
  232.           WriteSerie................................................... 44
  233.           ReadCarSerie................................................. 44
  234.           WriteCarSerie................................................ 44
  235.           Peek_rcp..................................................... 44
  236.           Poke_rcp..................................................... 44
  237.           WriteCmde.................................................... 45
  238.           Status_Trait_Erreurs......................................... 45
  239.           Def_Trait_Erreurs............................................ 45
  240.           Etat_du_Modem................................................ 45
  241.           set_DTR...................................................... 45
  242.           clear_DTR.................................................... 45
  243.           set_RTS...................................................... 45
  244.           clear_RTS.................................................... 45
  245.           set_OUT1..................................................... 46
  246.           clear_OUT1................................................... 46
  247.           Send_break................................................... 46
  248.           Errors_Report................................................ 46
  249.           Port_Free.................................................... 46
  250.  
  251.                                                                        iv
  252.  
  253.  
  254.           HandShake_Status............................................. 46
  255.           HandShake_setup.............................................. 46
  256.           XonoffShaking_Status......................................... 46
  257.           XonoffShaking_setup.......................................... 47
  258.           Set_routine.................................................. 47
  259.           Unset_routine................................................ 47
  260.           Set_err_routine.............................................. 47
  261.           Unset_err_routine............................................ 47
  262.           Verrouille................................................... 47
  263.           Deverrouille................................................. 47
  264.           GetPortName.................................................. 47
  265.           GetPortDevice................................................ 47
  266.           ResetPortDevice.............................................. 48
  267.           EmulBIOS..................................................... 48
  268.           SetEmulBIOS.................................................. 48
  269.           OrdiType..................................................... 48
  270.           SetOrdiType.................................................. 48
  271.  
  272.       5- STARCOMM.EXE errors codes..................................... 49
  273.  
  274.                                                                         v
  275.  
  276.  
  277.  
  278.  
  279.  
  280.   II- INTERFACING, for the PROGRAMMERS, from the DOS INT 21h:
  281.  
  282.       1- Direct access to the DOS DEVICE DRIVER:
  283.  
  284.           Function 3Dh: OPEN-DEVICE: opening a DEVICE.................. 50
  285.           Function 3Eh: CLOSE-DEVICE: closing a DEVICE................. 50
  286.           Function 3Fh: READ: reading of N bytes....................... 51
  287.           Function 40h: WRITE: writing of N bytes...................... 52
  288.           Function 44h: Check-INPUT: available bytes to read ?......... 52
  289.           Function 44h: Check-OUTPUT: available room in transmit ?..... 52
  290.           Function 44h: IOCtrl-READ: Reading the comm. parameters...... 52
  291.           Function 44h: IOCtrl-WRITE: Definition of the comm. param.... 53
  292.  
  293.       2- Procedures interfacing for TURBO PASCAL and TURBO-C:
  294.  
  295.           - Global variables........................................... 54
  296.           - Available procedures and functions......................... 54
  297.  
  298.       3- Description of the procedures interfacing to the PASCAL:
  299.  
  300.           Open_COMM.................................................... 55
  301.           Close_COMM................................................... 55
  302.           IOStream_READ................................................ 55
  303.           IOStream_WRITE............................................... 56
  304.           CheckCOMMIn.................................................. 56
  305.           CheckCOMMOut................................................. 56
  306.           ReadCOMM..................................................... 56
  307.           WriteCOMM.................................................... 56
  308.  
  309.       4- Description of the procedures interfacing to the C:
  310.  
  311.           Open_COMM.................................................... 57
  312.           Close_COMM................................................... 57
  313.           IOStream_READ................................................ 57
  314.           IOStream_WRITE............................................... 58
  315.           CheckCOMMIn.................................................. 58
  316.           CheckCOMMOut................................................. 58
  317.           ReadCOMM..................................................... 58
  318.           WriteCOMM.................................................... 58
  319.  
  320.       5- DOS errors codes.............................................. 59
  321.  
  322.  
  323.  
  324.  
  325.  
  326.   III- INTERFACING, for the PROGRAMMERS, to SCLIB.OBJ.................. 60
  327.  
  328.  
  329.  
  330.  
  331.  
  332.   ANNEX: Management of the differents hand-shakings.................... 61
  333.  
  334.                                                                         1
  335.  
  336.  
  337.  
  338.  
  339.  
  340.   I- INTERFACING, for the PROGRAMMERS, from the INT 14h:
  341.   ══════════════════════════════════════════════════════
  342.       The interrupt service number 14h protects the registers DS, ES, DI,
  343.    SI, BX, CX, DX, and BP (as well as, of course, CS:IP, SS:SP and the
  344.    the Flags indicators register, the Carry-Flags (CF) excepted). The only
  345.    modified registers are those specified in the "Return" paragraph of each
  346.    function. Note that AX is always altered.
  347.  
  348.       In case of an error, the Carry Flag is active and AH gives the code of
  349.    the reported error. In case of no error, the Carry Flag is unset
  350.    (CF=0) and AH=0.
  351.       Note that in case of an error 5 (AH=5 => specified port is reported
  352.    unknown by STARCOMM), the information of the registers others than AH (in
  353.    the return part) is without any meaning !
  354.  
  355.       This new services interrupt number 14h is fully re-entrant.
  356.  
  357.  
  358.  
  359.       1- Direct access to the driver:
  360.       ───────────────────────────────
  361.       Use "INT 14h" in assembler, reporting yourself to the reference manual
  362.    being constituted by the present paragraph.
  363.       The standard functions 0 to 3 of the BIOS interrupt 14h remain availables
  364.    even though STARCOMM has been successfully installed in memory...
  365.       For any high level languages, refer to the reference manual provided
  366.    with your compiler in order to find how to have "direct access" to the CPU
  367.    registers and how to activate a precise soft-interrupt (the interrupt
  368.    number 14h in the occurrence....). For the BorLand PASCAL and C languages,
  369.    use the interfacing procedures provided in the STARINTF.PAS and STARINTF.C
  370.    files (Cf. following paragraph...).
  371.  
  372.                                                                         2
  373.  
  374.  
  375.  
  376.  
  377.  
  378.         Function 00h: This function of the BIOS interrupt 14h is filtered
  379.                 by our routine, and then redirected to our treatment; this is
  380.                 done to assure a good initialization of the serial ports COM1:
  381.                 to COM8:, thus being included in our installed serial driver.
  382.  
  383.                 Call:        AH = 00h
  384.                              DX = <port number to manage>
  385.                                   (0 to 7 for COM1: to COM8:).
  386.                              AL = byte profile:
  387.                                    b1-b0 Word length
  388.                                      00: 5 bits
  389.                                      01: 6 bits
  390.                                      10: 7 bits
  391.                                      11: 8 bits
  392.                                    b2 Number of stop-bits
  393.                                      0: 1 stop-bit.
  394.                                      1: 1.5 stop-bit for a 5 data bits,
  395.                                         2 stop-bits in the other cases.
  396.                                    b4-b3 Parity
  397.                                      00 or 10: Without parity
  398.                                      01: Odd parity
  399.                                      11: Even parity
  400.                                    b7-b6-b5 Speed
  401.                                      000: 110 bit/s ▌ 100: 1200 bit/s
  402.                                      001: 150 bit/s ▌ 101: 2400 bit/s
  403.                                      010: 300 bit/s ▌ 110: 4800 bit/s
  404.                                      011: 600 bit/s ▌ 111: 9600 bit/s
  405.                 Return:      AX = Values of the line status register (AH)
  406.                                   and of the modem register (AL), in the same
  407.                                   order than the BIOS report.
  408.                                   (AX=0 if the port is unknown...).
  409.  
  410.         Functions 01h to 03h: When the port pointed by DX is acknowledged but
  411.                 not opened,the requested function is redirected to the initials
  412.                 BIOS functions (that may be emulated if this option is
  413.                 active...). Otherwise, the reactions of these 3 functions are
  414.                 the following:
  415.                     Function 01h=  Call:   AH = 01h
  416.                                               AL= <byte to send>
  417.                                               DX= <port number>
  418.                                    Return: AX = <Status of port>
  419.                                               (Cf. Function 03h)
  420.                                This function functionally reacts like the
  421.                              function 15h does.
  422.                     Function 02h=  Call:   AH = 02h
  423.                                               DX= <port number>
  424.                                    Return: AL = <byte received>
  425.                                               AH= <Status of the line>
  426.                                               (Cf. Function 03h)
  427.                                This function FUNCTIONALLY reacts like the
  428.                              function 14h does.
  429.  
  430.                                                                         3
  431.  
  432.  
  433.  
  434.  
  435.  
  436.                     Function 03h=  Call:    AH = 03h
  437.                                               DX= <port number>
  438.                                    Return:  AX = <Status of port>
  439.                                The call to this function (as well as the call
  440.                              to functions 01h and 02h) provokes a resetting
  441.                              to 0 of all the communication errors flags.
  442.                                The status word bits returned in AX have the
  443.                              following meaning: (for a value of 1)
  444.                                  AH = <Line status>
  445.                                       Bit 0= data to receive are available in
  446.                                              the receiving buffer
  447.                                       Bit 1= Overrun(s) received
  448.                                       Bit 2= Parity error(s) in receipt
  449.                                       Bit 3= Error on stop-bit in receipt
  450.                                       Bit 4= BREAK received
  451.                                       Bit 5= Available room in transmit buffer
  452.                                       Bit 6= The transmit buffer is empty
  453.                                       Bit 7= Time-out error (in reading
  454.                                              or in writing depending on
  455.                                              whether AH=1 or 2 to the call !).
  456.                                              In this case of error, all the
  457.                                              other bits are 0 and don't have
  458.                                              any meaning (this including AL).
  459.                                  AL = <Modem status>
  460.                                       Bit 0 = delta CTS
  461.                                       Bit 1 = delta DSR
  462.                                       Bit 2 = delta RI
  463.                                       Bit 3 = delta DCD
  464.                                         For the 0 to 4 bits, the condition to 1
  465.                                       means: "Occurred at least 1 time since
  466.                                       the last call to the present function".
  467.                                       Bit 4 = CTS signal status
  468.                                       Bit 5 = DSR signal status
  469.                                       Bit 6 = RI signal status
  470.                                       Bit 7 = DCD signal status
  471.  
  472.                                                                         4
  473.  
  474.  
  475.  
  476.  
  477.  
  478.         Function 04h:This function of the BIOS interrupt 14h is filtered by our
  479.                 routine, and then redirected to our treatment; this is done in
  480.                 order to assure a good initialization of the serial ports COM1:
  481.                 to COM8:, that is embedded by the installed serial port driver.
  482.                 Note that this function 04h only exists on the PS/2 models.
  483.  
  484.                 Call:        AH = 04h
  485.                              DX = <port number to manage>
  486.                                   (0 to 7 for COM1: to COM8:).
  487.                              AL = Permanent state of the BREAK signal.
  488.                                    0: Out service (steady value= 0)
  489.                                    1: In service (steady value= 1)
  490.                              CL = Transmission speed.
  491.                                   Only b0 to b3. Set b4 to b7 to a null value.
  492.                                   (i.e. CL= 0 to 12 for 110 bits/s to
  493.                                   115200 bits/s.).
  494.                                      0000 for 110 bits/s ▌ 1000 for 19200
  495.                                      0001  "  150    "   ▌ 1001 for 28800
  496.                                      0010  "  300    "   ▌ 1010 for 38400
  497.                                      0011  "  600    "   ▌ 1011 for 57600
  498.                                      0100  "  1200   "   ▌ 1100 for 115200
  499.                                      0101  "  2400   "   ▌ 1101  (=> 9600)
  500.                                      0110  "  4800   "   ▌ 1110   "    "
  501.                                      0111  "  9600   "   ▌ 1111   "    "
  502.                              CH = Word length
  503.                                      00: 5 bits
  504.                                      01: 6 bits
  505.                                      10: 7 bits
  506.                                      11: 8 bits
  507.                              BL = Number of stop-bits
  508.                                      0: 1 stop-bit.
  509.                                      1: 1.5 stop-bit for a 5 data bits,
  510.                                         2 stop-bits in the other cases.
  511.                              BH = Parity
  512.                                     000: Without parity
  513.                                     001: Odd parity
  514.                                     010: Even parity
  515.                                     011: Parity work (= odd indicator)
  516.                                     100: Parity rest (= even indicator)
  517.                 Return:      AX = Values of the line status signals (AH) and of
  518.                                   the modem status (AL), in the same order than
  519.                                   the BIOS report.
  520.                                   (AX=0 if the port is unknown...).
  521.  
  522.                                                                         5
  523.         Function 05h: Direct access to the modem control register. This
  524.                 function is usually not available except on PS/2 models. The
  525.                 OUT2 signal is protected by our function for the installed
  526.                 driver hard-interrupt health !
  527.  
  528.                 Call:        AH = 05h
  529.                              DX = <port number to manage>
  530.                                   (0 to 7 for COM1: to COM8:).
  531.                              AL = <Under-function code>
  532.                                    0: Request the modem status signals.
  533.                                    1: Set the signals indicated by BL.
  534.                              BL = byte to place in the modem control
  535.                                   register (if AL=1).
  536.                                    bit 0: DTR signal.
  537.                                    bit 1: RTS signal.
  538.                                    bit 2: exit OUT1.
  539.                                    bit 3: exit OUT2: It is filtered !...
  540.                                    bit 4: Loop-back mode control.
  541.                 Return:      AH = Values of the line status signals.
  542.                              AL = Values of the modem status signals.
  543.                              If call with AL=0:
  544.                                BL = Status of the modem control signals.
  545.  
  546.         Function 06h: Ask the RAM loaded driver version number.
  547.  
  548.                 Call:        AH = 06h
  549.                              (DX = port number un-usefull !)
  550.                 Return:      AH = 0
  551.                              AL = <Major code>
  552.                              DI = <2 minor codes>
  553.                              These codes are returned in ASCII.
  554.  
  555.         Function 07h: Control the specified port activity. Set the modem
  556.                 control signals in agreement with the activity defined for the
  557.                 port.
  558.                 Resets to 0 the errors flags at any efficient port opening,
  559.                 and adapts the state of the DTR, RTS and OUT2 signals to the
  560.                 real port status.
  561.                 Permits to define the transmission mode to activate: slow
  562.                 (under control of the clock interrupt) or fast (under control
  563.                 of the UART chip).
  564.  
  565.                 Call:        AH = 07h
  566.                              DX = <port number to manage>
  567.                                   (0 to 7 for COM1: to COM8:).
  568.                              AL = <Under-function code>
  569.                                  0: Port activation. The DTR, RTS and OUT2
  570.                                     signals are set to 1, and the errors
  571.                                     flags are set to 0 when the port activa-
  572.                                     tion is successfull; uses the driver
  573.                                     internal buffers.
  574.                                  1: Disactivate the port, if there is no more
  575.                                     byte(s) to send.
  576.                                     All the modem signals are set to 0 when
  577.                                     the disactivating is effective.
  578.                                  2: Is the port opened ?
  579.                                  3: Initializing the designated port with
  580.                                     the transmission mode to the reduced flow.
  581.                                     The port remains in its present state
  582.                                     (whereas opened or closed).
  583.                                  4: Initializing the designated port with the
  584.                                     transmission mode to an elevated flow. The
  585.                                     port remains in its present state (whereas
  586.                                     opened or closed).
  587.                                  5: Is the slow transmission mode active ?
  588.  
  589.                                                                         6
  590.  
  591.                                  6: Like 0, but in using external buffers;
  592.                                     these are to be reserved in CONVENTIONAL
  593.                                     MEMORY and in a UNIQUE MEMORY SEGMENT.
  594.                                     In this case are:
  595.                                       ES:DI indexes the reserved area (bottom),
  596.                                       BX    receipt buffer size,
  597.                                       CX    transmit buffer size.
  598.                                       Each buffer size = 256 bytes at least.
  599.                                       It IS NECESSARY: DI+BX+CX <= 0FFFFh !
  600.                                  7: Unconditional port closing.
  601.                 Return:      AH = <Error code>
  602.                                  0: No error. AL gives the port status, only
  603.                                     for the under-function 2):
  604.                                         0: driver inactive, signals to 0;
  605.                                         1: driver active, DTR and OUT2 to 1.
  606.                                     Or AL gives the mode of active transmit
  607.                                     (only for the under-function 5):
  608.                                         0: fast transmit flow,
  609.                                         1: slow transmit flow.
  610.                                  1: Specified under-function is unknown.
  611.                                  5: Port specified is unknown.
  612.                                  7: Bytes to send are remaining in the port
  613.                                     transmit buffer. The port closing is
  614.                                     therefore reported !
  615.                                     (This code could only be received
  616.                                     following a call with AL=1...).
  617.                                  8: Port re-activation not done: this
  618.                                     port is already active !
  619.                                     (This code could only be returned
  620.                                     following a call with AL=0 or 6...).
  621.                                  9: Unable to open: no more available
  622.                                     buffers (with AL=0) OR buffers not given in
  623.                                     the same memory segment, OR one of the
  624.                                     2 buffers is too small (with AL=6) !
  625.                                 10: Unable to recover the buffers allocated
  626.                                     to the port to close. The port is physi-
  627.                                     -cally closed, but a buffers pair is
  628.                                     then lost for all ulterior using !
  629.                                     (This error is normally impossible except
  630.                                     a serious error of your central memory).
  631.  
  632.         Function 08h: Activation of a new port (between COM1: and COM8:).
  633.                 All the acknowledged ports are closed, except the one specified
  634.                 to be opened and reactivated (with an INTERNAL driver buffer).
  635.                 Resets the errors flags to 0 when the new port has revealed
  636.                 itself accessible (...and has therefore been opened !).
  637.  
  638.                 Call:        AH = 08h
  639.                              DX = <port number to activate>
  640.                                   (0 to 7 for COM1: to COM8:).
  641.                 Return:      AH = <Error code>
  642.                                    0: No error.
  643.                                    5: Requested port not found (i.e. "marked
  644.                                       unknown") on the used computer,
  645.                                       and for the present session
  646.                                       (Cf. "/G..." option...).
  647.                                    9: Unable to open: NO available buffer.
  648.                                   10: Impossibility of recovering a buffer
  649.                                       allocated to a previous open port !
  650.                                       The specified port to activate is not
  651.                                       open: function is interrupted.
  652.                              AL = 0
  653.  
  654.                                                                         7
  655.  
  656.         Function 09h: Request information on the available hardware and its
  657.                 exploitation, or definition of new hardware parameters
  658.                 (on a specified port). For the definition of new parameters,
  659.                 it is necessary to keep in mind that the treatment is
  660.                 canceled if the specified address reveals itself incorrect
  661.                 (no UART found). In this case, there won't be any modification
  662.                 in the concerned port initialization. On the other hand, once
  663.                 the address has been validated, the remainder of the function
  664.                 will be fully executed. If the indicated IRQ is not admissible
  665.                 (out of 2,3,4,5,7,10,11,12, or 15; Or IRQ2 requested on an AT,
  666.                 or IRQ5 requested on a XT, or an IRQ superior or equal to 10
  667.                 is requested on an AT commuter type; Or corresponding vectors
  668.                 found rerouted by an application executed after STARCOMM
  669.                 thus making an IRQ conflict), it will be unknown, and the
  670.                 former IRQ will remain in use. Finally, the number of bytes
  671.                 to exploit on a possible FIFO must be included between 2 and
  672.                 15. If it is greater than 15, it is brought back to 15. If it
  673.                 equals to 1, it is brought back to 2. A value of 0 forbade to
  674.                 exploit a FIFO, even though it is available to the
  675.                 specified address.
  676.                   All STARCOMM port can be defined by this function (even
  677.                 though it is considered unknown following the installation
  678.                 checking, or resulting from the "/G..." option). If the address
  679.                 is correct and if the former/news IRQ are not rerouted by an
  680.                 other post-loaded program, the port becomes existing even
  681.                 though it was definite unknown before, because it henceforth
  682.                 becomes usable (address and interrupt are good and well
  683.                 initialized...).
  684.                   ATTENTION: Modifying an OPEN port is FORBIDDEN !
  685.  
  686.                 Call:        AH = 09h
  687.                              AL = <under-function code>
  688.                                    0: Information on the used parameters.
  689.                                    1: Definition of new parameters.
  690.                              DX = <port number to manage>
  691.                                   (0 to 7 for COM1: to COM8:).
  692.                                   For the under-function 1 (AL=1), it is
  693.                                   also necessary to inform the following
  694.                                   registers:
  695.                                BX = <New address of the UART>,
  696.                                CH = <IRQ associated to this port>
  697.                                    Possible values= 2,3,4,5,7,10,11,12,15 Or:
  698.                                    'A' (or 'a') demanding the function to
  699.                                    automatically determine the IRQ on which
  700.                                    the UART seems to be installed on.
  701.                                 !! NEVER USE The AUTOMATIC IRQ RESEARCH
  702.                                 !! UNDER WINDOWS OR THE DOS OPERATING
  703.                                 !! SYSTEM WILL CRASH !...
  704.                                CL = <FIFO buffer activity>,
  705.                                     0: FIFO utilization not authorized.
  706.                                    >1: Authorized if any FIFO is present.
  707.                                     CL must give the number of bytes that
  708.                                     the driver will have the right to use
  709.                                     in this buffer integrated to the UART.
  710.                 Return:      AH = <Error code>
  711.                                    0: No error.
  712.                                    1: Requested under-function unknown.
  713.                                    5: The port is unknown.
  714.                                 and, only in return of a call with AL=1:
  715.                                   11: The port is opened (the port must be
  716.                                       closed to modify its physical
  717.                                       parameters).
  718.  
  719.                                                                         8
  720.                                   12: The specified address reveals itself
  721.                                       incorrect.
  722.                                 The following registers don't have any
  723.                               meaning except if AL=0 to the call, AND
  724.                               if AH=0 OR 5 to the return:
  725.                              AL = <UART type>
  726.                                    1: 8250, 16450 or compatible equivalent,
  727.                                    2: 16550 with included FIFO buffer.
  728.                              BX = <UART address>,
  729.                              CH = <IRQ associated to this UART>,
  730.                              CL = <FIFO buffer activity>,
  731.                                    0: FIFO unknown (UART is not a 16550),
  732.                                       or FIFO unactivated,
  733.                                    Otherwise: FIFO Present, active and used.
  734.                                    CL contains the number of bytes that the
  735.                                    driver has the right of using in this
  736.                                    UART integrated buffer.
  737.  
  738.         Function 0Ah: Control the authorization to access the serial
  739.                 ports COM1: to COM8:. This permits the applications to
  740.                 dynamically adjust any IRQ conflict that may occur on
  741.                 particular materials...
  742.                 It also permits to control the affectation of serial port(s)
  743.                 to some other specific drivers.
  744.                 ATTENTION: If the IRQ associated to the port has been
  745.                 diverted, this function refuses to work and returns an
  746.                 error 5 (this is necessary in order to protect the IRQ chaining
  747.                 in the computer) ! If the new IRQ can be used, the associated
  748.                 port is always returned CLOSED by the function.
  749.                 This function also permits to control the locking of the comm
  750.                 speed and format for each accessible serial port.
  751.  
  752.                 Call:        AH = 0Ah
  753.                              AL = <Code of under-function>
  754.                                    0: Forbade the access to the specified port.
  755.                                       (close this port, restores its inits,
  756.                                       and disactivates its possible 'user_it')
  757.                                    1: Allow the access to the specified port.
  758.                                    ATTENTION: The function 09h, under-
  759.                                    function 1, can also reset as accessible
  760.                                    a port initially forbidden !).
  761.                                    2: No locking on "Speed/Format".
  762.                                    3: Locking only the speed.
  763.                                    4: Locking only the format.
  764.                                    5: Locking speed AND format.
  765.                                    6: Requesting the Speed/Format locking state
  766.                              DX = <port number to manage>
  767.                                   (0 to 7 for COM1: to COM8:).
  768.                 Return:      AH = <Error code>
  769.                                    0: No error.
  770.                                    1: Nb of under-function unknown.
  771.                                    5: The port is unknown: the access to
  772.                                       the port is still forbidden (only under-
  773.                                       function 1 for this error...).
  774.                                       OR: the IRQ associated to the port is
  775.                                       diverted; the function could not be
  776.                                       executed without danger (this for the
  777.                                       number 2 under-function) !
  778.                                   10: Impossibility to recover the buffer
  779.                                       associated to the port to close. The port
  780.                                       is closed but its access is still autho-
  781.                                       -rized. A buffer is lost (under-funct 0)!
  782.                                 AL = <Speed/Format locking status>
  783.                                    Only differs from 0 when AL=6 at call time !
  784.                                    Worth from 2 to 5 according the same coding
  785.                                    that the one for AL at call time.
  786.  
  787.                                                                         9
  788.  
  789.  
  790.  
  791.  
  792.  
  793.         Function 0Bh: Initialize communication format and speed.
  794.                 What are the receipt and transmit buffers sizes ?
  795.                 !! ATTENTION: Do NOT use 115200 bauds on a slow PC computer as
  796.                 !! the hard-interrupt receive routine is not working fast
  797.                 !! enough on these machines. Besides, it really worth using
  798.                 !! a 16450 (or 16550) UART type to use speeds greater than
  799.                 !! 9600 Bauds !
  800.  
  801.                 Call:        AH = 0Bh
  802.                              DX = <port number to manage>
  803.                                   (0 to 7 for COM1: to COM8:).
  804.                              BH = Bits transmission speed.
  805.                                   Only b0 to b3. Set b4 to b7 at 0 values.
  806.                                   (i.e. BH= 0 to 12 for 110 bits/ s to
  807.                                   115200 bits/ s.).
  808.                                     0000 for 110 bits/s ▌ 1000 for 19200
  809.                                     0001  "  150    "   ▌ 1001 for 28800
  810.                                     0010  "  300    "   ▌ 1010 for 38400
  811.                                     0011  "  600    "   ▌ 1011 for 57600
  812.                                     0100  "  1200   "   ▌ 1100 for 115200
  813.                                     0101  "  2400   "   ▌ 1101 (=> 9600)
  814.                                     0110  "  4800   "   ▌ 1110   "   "
  815.                                     0111  "  9600   "   ▌ 1111   "   "
  816.                              BL = Number of data-bits, parity and stop-bits.
  817.                                    Only b0 to b6. b7 is to be set null.
  818.                                    b1-b0 Word length
  819.                                      00: 5 bits
  820.                                      01: 6 bits
  821.                                      10: 7 bits
  822.                                      11: 8 bits
  823.                                    b2 Number of stop-bits
  824.                                      0: 1 stop-bit.
  825.                                      1: 1.5 stop-bit for a 5 data bits,
  826.                                         2 stop-bits in the other cases.
  827.                                    b5-b3 Parity
  828.                                      xx0: Without parity
  829.                                      001: Odd parity
  830.                                      011: Even parity
  831.                                      101: Parity work (= odd indicator)
  832.                                      111: Parity rest (= even indicator)
  833.                                    b6 State of the break signal
  834.                                      0: Out service (steady value=0)
  835.                                      1: In service (steady value=1)
  836.                 Return:      AH = <Error code>
  837.                                    0: No error.
  838.                                    5: Specified port is unknown.
  839.                                    6: Speed un-valid. Init. achieved to 9600
  840.                                       bit/s by default.
  841.                              AL = 0
  842.                              BX = <Size of receipt buffer (in bytes)>
  843.                              CX = <Size of transmit buffer (in bytes)>
  844.  
  845.                                                                        10
  846.  
  847.  
  848.         Function 0Ch: Reading the communication format used by the specified
  849.                 port.
  850.                 !! ATTENTION: Assure yourself that a (at least) 3 bytes
  851.                 !! destination string is provided in order to avoid any data
  852.                 !! destruction in memory, or (WORSE!) to avoid the in-coming
  853.                 !! data bytes to be written over executable code.
  854.  
  855.                 Call:        AH = 0Ch
  856.                              DX = <port number to manage>
  857.                                   (0 to 7 for COM1: to COM8:).
  858.                               Where: DI= Seg:Off of the 3 bytes string used
  859.                                    to store the initialization data.
  860.                 Return:      AH = <Error code>
  861.                                    0: No error.
  862.                                    5: Specified port is unknown.
  863.                               If AH=0 only:
  864.                                 byte 1:   Serial port concerned (recall),
  865.                                 byte 2+3: Communication format, in the
  866.                                           same coding that the one used by
  867.                                           the initialization function #09.
  868.                                 byte 2= used speed, byte 3= used structure
  869.  
  870.         Function 0Dh: Acquirement of the useful informations concerning the
  871.                 INTERNAL buffers used by STARCOMM: their sizes, the number of
  872.                 available buffers, and the number of buffer already in use.
  873.  
  874.                 Call:        AH = 0Dh
  875.                 Return:      AH = 0
  876.                              BX = <Size (bytes) of the receipt buffers>
  877.                              CX = <Size (bytes) of the transmit buffers>
  878.                              DH = <Nb. of used buffer(s)>
  879.                              DL = <Nb. of still un-used buffer(s)>
  880.  
  881.         Function 0Eh: Set the receipt and transmit buffers empty and
  882.                 reset the errors flags to 0.
  883.  
  884.                 Call:        AH = 0Eh
  885.                              DX = <port number to manage>
  886.                                   (0 to 7 for COM1: to COM8:).
  887.                 Return:      AH = <Error code>
  888.                                    0: No error.
  889.                                    5: Specified port is unknown.
  890.  
  891.         Function 0Fh: Initializes the receipt and set its buffer empty.
  892.  
  893.                 Call:        AH = 0Fh
  894.                              DX = <port number to manage>
  895.                                   (0 to 7 for COM1: to COM8:).
  896.                 Return:      AH = <Error code>
  897.                                    0: No error.
  898.                                    5: Specified port is unknown.
  899.  
  900.                                                                        11
  901.  
  902.  
  903.  
  904.  
  905.  
  906.         Function 10h: Initializes the transmit and set its buffer empty.
  907.  
  908.                 Call:        AH = 10h
  909.                              DX = <port number to manage>
  910.                                   (0 to 7 for COM1: to COM8:).
  911.                 Return:      AH = <Error code>
  912.                                    0: No error.
  913.                                    5: Specified port is unknown.
  914.  
  915.         Function 11h: Permits to set the elapse time at which the driver must
  916.                 generate a time-out error (in reading or in writing), following
  917.                 an un-successful input (or output). To the return of this
  918.                 function, the previous limiting time-out values are returned.
  919.                 Note that the port is initialized (format and speed), its
  920.                 buffers are reseted empty and all its errors flags are set
  921.                 to 0 at this function return.
  922.  
  923.                 Call:        AH = 11h
  924.                              DX = <port number to manage>
  925.                                   (0 to 7 for COM1: to COM8:).
  926.                              BH = <Reading time-out>
  927.                                   This value must be included between 1 and
  928.                                   255 half second(s). The value 0 allows to
  929.                                   un-modify the current value used by the
  930.                                   driver (useful if you only want to ask the
  931.                                   current used values !).
  932.                              BL = <Writing time-out>
  933.                                   Same commentaries as above.
  934.                 Return:      AH = <Error code>
  935.                                    0: No error.
  936.                                    5: Specified port unknown.
  937.                              BH = <Precedent reading time-out in use>
  938.                                   This value, like above, is included between 1
  939.                                   and 255 half of a second.
  940.                              BL = <PRECEDENT writing time-out in use>
  941.                                   Same commentaries as above.
  942.  
  943.         Function 12h: Ask the driver the substitution mode that is used,
  944.                 and the code of replacement used for the mode Smode1
  945.                 (see "Function 13h" for more explanations).
  946.                 Also permits to define the activity status of the function
  947.                 to represent the BREAK into the receipt buffers, using the
  948.                 special code that is associated to the Break-interrupt.
  949.  
  950.                 Call:        AH = 12h
  951.                              DX = <port number to manage>
  952.                                   (0 to 7 for COM1: to COM8:).
  953.                 Return:      AH = <Error code>
  954.                                    0: No error.
  955.                                    5: port nominee definite unknown.
  956.                              AL = {Smode0, Smode1, or Smode2}
  957.                                    AL worth (Smode? + 100) if Bmode1 is used;
  958.                                    It is NOT modified if Bmode0 is used.
  959.                              BL = <Code of erroneous bytes replacement>
  960.                              BL = <Code to represent a BREAK in the buffer>
  961.  
  962.                                                                        12
  963.  
  964.  
  965.  
  966.  
  967.  
  968.         Function 13h: Set the substitution process working status concerning
  969.                 the deficient bytes in receipt. This process is inactive by
  970.                 default. It allows to fix the location of doubtful received
  971.                 bytes (parity or stop bit error) even when stocked in the
  972.                 receipt buffer. Indeed: in case of error(s), the UART first
  973.                 warns the CPU about this error. It then generates a second
  974.                 interrupt (for the SAME byte) demanding the CPU to read that
  975.                 byte as it has been decoded, in spite of the raised error.
  976.                 Then, the receipt process can store this byte in its buffer in
  977.                 forgetting the error that is associated with (Smode0); it can
  978.                 replace it by a special code in common agreement with your
  979.                 wishes (Smode1); or it can voluntarily lose this byte after
  980.                 having incremented the number of lost bytes in receipt (Smode2:
  981.                 the same flag variable is used here than the one that counts
  982.                 the receipt bytes lost due to a FULL receipt buffer...). It is
  983.                 the present function that allows you to fix what treatment mode
  984.                 must be applied by the driver on the receipt errors.
  985.                   This function also permits to command the "BREAK-interrupt
  986.                 substitution process" (i.e. permits to specify if we want to
  987.                 find a special BREAK-code in the receipt buffer for each
  988.                 BREAK that is received, or NOT...).
  989.  
  990.                 Call:        AH = 13h
  991.                              DX = <port number to manage>
  992.                                   (0 to 7 for COM1: to COM8:).
  993.                              AL = <mode of working>
  994.                                    0: mode Smode0.
  995.                                    1: mode Smode1.
  996.                                    2: mode Smode2.
  997.                                    100: mode Bmode0.
  998.                                    200: mode Bmode1.
  999.                                    There is NO connection between the 2 "substi
  1000.                                    -tution" functions Smode and Bmode.
  1001.                                    You can set Smode using a first call, and
  1002.                                    then set Bmode in a second call without
  1003.                                    canceling the effect onto Smode...
  1004.                              BL = <Code of replacement>
  1005.                                    It is the code of substitution used in the
  1006.                                    only modes Smode1 and Bmode1.
  1007.                               The code in BL is to be specified if AL=Smode1
  1008.                               or Bmode 1, but useless otherwise.
  1009.                 Return:      AH = <Error code>
  1010.                                    0: No error,
  1011.                                    1: Unknown working mode !
  1012.                                    5: Specified port is unknown.
  1013.                              AL = <Active working mode>
  1014.                                    0: mode Smode0.
  1015.                                    1: mode Smode1.
  1016.                                    2: mode Smode2.
  1017.                                    100 is added to AL if Bmode1 is active
  1018.                                    (it is unchanged if Bmode0 is active...).
  1019.  
  1020.                                                                        13
  1021.  
  1022.         Function 14h: Read data from the receipt buffer.
  1023.                 If you ask to read more data than received, this function
  1024.                 waits for other data to get in before returning to the
  1025.                 calling process.
  1026.                 (Loop reading until receipt of a break signal, or time-out,
  1027.                 or completion of the request...).
  1028.  
  1029.                 Call:        AH = 14h
  1030.                              DX = <port number to manage>
  1031.                                   (0 to 7 for COM1: to COM8:).
  1032.                              CX = Number of expected bytes.
  1033.                               Where: DI= Seg:Off of first byte of the string
  1034.                                        in which to store the <CX> expected
  1035.                                        bytes.
  1036.                                 !! ATTENTION: Assure to reserve a sufficient
  1037.                                 !! space !...
  1038.                 Return:      AH = <Error code>
  1039.                                    0: No error.
  1040.                                    2: Request Interrupted by a break interrupt
  1041.                                    3: You asked to read NO byte ! ? . . .
  1042.                                    4: Time-out occur in reading.
  1043.                                    5: Specified port is unknown.
  1044.                              CX = Number of bytes effectively read.
  1045.  
  1046.         Function 15h: Write data to send in the transmit buffer.
  1047.                 If you ask to write more data than room remaining in the
  1048.                 transmit buffer, this function waits to be able to finish
  1049.                 its action before returning to the calling process.
  1050.                 (Loop writing, up to the (writing) time-out limit !...).
  1051.  
  1052.                 Call:        AH = 15h
  1053.                              DX = <port number to manage>
  1054.                                   (0 to 7 for COM1: to COM8:).
  1055.                              CX = Number of bytes to send.
  1056.                               Where: DI= Seg:Off of the string to write.
  1057.                 Return:      AH = <Error code>
  1058.                                    0: No error.
  1059.                                    3: You asked to write NO byte ! ? . . .
  1060.                                    4: Time-out occur in writing:
  1061.                                       !! Too much consecutive TIME-OUT can
  1062.                                       !! result from 2 differents errors:
  1063.                                       !!  - the communication with the device
  1064.                                       !!    is blocked, Or (/and)
  1065.                                       !!  - an other program has interfered
  1066.                                       !!    in local with our driver,
  1067.                                       !!    inhibiting its hard-interrupts,
  1068.                                       !!    or in modifying the
  1069.                                       !!    programming of the UART.
  1070.                                       !! It is advisable, for this last
  1071.                                       !! event, to reset the used port.
  1072.                                       !! It will reactivate the communication
  1073.                                       !! when the error comes from the
  1074.                                       !! local computer.
  1075.                                    5: Specified port is unknown.
  1076.                              CX = Number of bytes effectively written.
  1077.  
  1078.                                                                        14
  1079.  
  1080.  
  1081.  
  1082.  
  1083.  
  1084.         Function 16h: Reading, without expectation, one byte from the
  1085.                 receipt buffer. Finish immediately, without utilization of
  1086.                 any time-out, whether the reading could take place or not !
  1087.  
  1088.                 Call:        AH = 16h
  1089.                              DX = <port number to manage>
  1090.                                   (0 to 7 for COM1: to COM8:).
  1091.                 Return:      AH = <Error code>
  1092.                                    0: No error.
  1093.                                    3: No byte is available, Or
  1094.                                       the specified port is closed !
  1095.                                    5: Specified port is unknown.
  1096.                              AL = <read byte> if AH=0, AL=0 otherwise.
  1097.  
  1098.         Function 17h: Writing, without expectation, one byte to the
  1099.                 transmit buffer. Finish immediately, without utilization of
  1100.                 any time-out, whether the writing could take place or not !
  1101.  
  1102.                 Call:        AH = 17h
  1103.                              AL = <byte to write>
  1104.                              DX = <port number to manage>
  1105.                                   (0 to 7 for COM1: to COM8:).
  1106.                 Return:      AH = <Error code>
  1107.                                    0: No error.
  1108.                                    3: No more room in the buffer, Or
  1109.                                       the specified port is closed !
  1110.                                    5: Specified port is unknown.
  1111.  
  1112.         Function 18h: Not destructive reading of one byte from the receipt
  1113.                 buffer.
  1114.  
  1115.                 Call:        AH = 18h
  1116.                              DX = <port number to manage>
  1117.                                   (0 to 7 for COM1: to COM8:).
  1118.                 Return:      AH = <Error code>
  1119.                                    0: No error.
  1120.                                    3: No available byte, Or
  1121.                                       the specified port is closed !
  1122.                                    5: Specified port is unknown.
  1123.                              AL = <read byte> if AH=0, AL=0 otherwise.
  1124.  
  1125.                                                                        15
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.         Function 19h: Writing, without expectation, one byte into the receipt
  1132.                 buffer. This function thus permits to simulate the receipt of
  1133.                 a byte. It precisely proceed like the receipt hard-interrupt
  1134.                 regarding the hand-shaking flow controls (hard of soft), when
  1135.                 this/these is/are active(s): transmit of an 'Xoff' when the
  1136.                 buffer becomes too full and Xon/Xoff is supposed acknowledged
  1137.                 by the remote, management of CTS and DTR following the same
  1138.                 criteria, recognition of the Xon and Xoff codes received if the
  1139.                 protocol is locally active, and management of the lost receipt
  1140.                 bytes flag when necessary.
  1141.                   This function therefore also permits to open a simple
  1142.                 producer access to the receipt buffer, that simulates (using
  1143.                 software only) the plug of a hardware transmission loop test !
  1144.  
  1145.                 Call:        AH = 19h
  1146.                              AL = <byte to write>
  1147.                              DX = <port number to manage>
  1148.                                   (0 to 7 for COM1: to COM8:).
  1149.                 Return:      AH = <Error code>
  1150.                                    0: No error.
  1151.                                    3: No more room in the buffer, Or
  1152.                                       the specified port is closed !
  1153.                                    5: Specified port is unknown.
  1154.  
  1155.         Function 1Ah: Write a string directly to the specified port, without
  1156.                 regarding any of the flow management signals,and in momentarily
  1157.                 disactivating the sending of the bytes from the buffer of the
  1158.                 normal transmit function. A time limit fixed to 3 clock thicks
  1159.                 is respected before every byte is sent. DTR is put to FALSE for
  1160.                 the length of this transmit, except if BH is FALSE (i.e. 0):
  1161.                 BH="Use DTR in order to specify the send of a control string
  1162.                 for the modem"... Thus, if you disactivate the control of DTR,
  1163.                 it will be necessary to send the prefix of associated command
  1164.                 to the used modem ("+" for an HAYES Compatible modem by
  1165.                 default...).
  1166.                 The main utilite of this function is to permit the access
  1167.                 to a modem (or to all other intelligent device) in order to
  1168.                 send it some specific commands made of a block.
  1169.                 This writing has therefore main priority and loops until
  1170.                 it succeed.
  1171.  
  1172.                 Call:        AH = 1Ah
  1173.                              DX = <port number to manage>
  1174.                                   (0 to 7 for COM1: to COM8:).
  1175.                              AL = Number of bytes to send.
  1176.                              BH = Utilization of DTR to specify the command ?
  1177.                                    0 (FALSE): NO
  1178.                                    1 (TRUE):  YES
  1179.                                 Where: DI= Seg:Off of first byte of the
  1180.                                      string of bytes to send.
  1181.                 Return:      AH = <Error code>
  1182.                                    0: No error.
  1183.                                    3: No byte given to send !...
  1184.                                    5: Specified port is unknown.
  1185.                              AL = 0
  1186.  
  1187.                                                                        16
  1188.  
  1189.  
  1190.  
  1191.         Function 1Bh: Make an expectation loop until the transmit buffer is
  1192.                 empty. This expectation won't last more than the number of half
  1193.                 seconds specified to the function. The reaction to decide is
  1194.                 then to be made by the calling program !
  1195.                 This expectation function finishes immediately if the specified
  1196.                 port is found closed to the call of the function.
  1197.  
  1198.                 Call:        AH = 1Bh
  1199.                              AL = <Maxi last of expectation>
  1200.                                   (in number of half seconds !)
  1201.                              DX = <port number to manage>
  1202.                                   (0 to 7 for COM1: to COM8:).
  1203.                 Return:      AH = <Error code>
  1204.                                    0: Transmit buffer is empty (no error...),
  1205.                                    4: Time-out: the length limits of
  1206.                                       expectation is over whereas the
  1207.                                       buffer is not empty yet.
  1208.                                    5: Specified port is unknown.
  1209.                                       (immediate return)
  1210.  
  1211.         Function 1Ch: Is the receipt buffer empty ?
  1212.                 How many bytes are there to read from this buffer ?
  1213.  
  1214.                 Call:        AH = 1Ch
  1215.                              DX = <port number to manage>
  1216.                                   (0 to 7 for COM1: to COM8:).
  1217.                 Return:      AH = <Error code>
  1218.                                    0: No error,
  1219.                                    5: Specified port is unknown.
  1220.                              AL = 0 if buffer NOT empty, 1 if buffer empty.
  1221.                              CX = Number of bytes to read.
  1222.  
  1223.         Function 1Dh: Is the transmit buffer full ?
  1224.                 How many bytes are remaining free in this buffer ?
  1225.  
  1226.                 Call:        AH = 1Dh
  1227.                              DX = <port number to manage>
  1228.                                   (0 to 7 for COM1: to COM8:).
  1229.                 Return:      AH = <Error code>
  1230.                                    0: No error,
  1231.                                    5: Specified port is unknown.
  1232.                              AL = 0 if buffer is NOT full, 1 if buffer is full
  1233.                              CX = Number of free bytes.
  1234.  
  1235.                                                                        17
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.         Function 1Eh: transmit of a break interrupt signal via the specified
  1242.                 serial port (precisely: sets to 1 the break signal during some
  1243.                 milli-seconds, then resets its initial value).
  1244.                 In receipt, this signal is stored by the driver of SERIAL PORTS
  1245.                 MANAGER, but it normally provokes no change of its working.
  1246.                 It is to the application program to define the reaction to
  1247.                 adopt to such a signal. The only case that make STARCOMM reacts
  1248.                 is when it is blocked in expectation of a reading:in this case,
  1249.                 the break interrupt will make to appear the reading "time-out"
  1250.                 immediately.
  1251.                 Note that a transition to 1 of the break signal could be not
  1252.                 detected if it was not initially set to 0 ! (See the function
  1253.                 0Bh to this subject).
  1254.  
  1255.                 Call:        AH = 1Eh
  1256.                              DX = <port number to manage>
  1257.                                   (0 to 7 for COM1: to COM8:).
  1258.                              BL = <Last of the signal to generate>
  1259.                                   This time-length could take all value between
  1260.                                   0 and 250 eighteenth of second; this will
  1261.                                   therefore make to generate signal long of the
  1262.                                   alone length of the signal commutation if
  1263.                                   BL=0, and long of 14 seconds if BL=250 !
  1264.                 Return:      AH = <Error code>
  1265.                                    0: No error.
  1266.                                    5: Specified port is unknown.
  1267.  
  1268.                                                                        18
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.         Function 1Fh: Reading the accounting of error(s) by possible type.
  1275.                 The call to this function provokes the reset to 0 of all
  1276.                 the errors flags. It belongs to the user of deciding how to
  1277.                 react in case of a too frequent error type in the same port.
  1278.                 !! ATTENTION: Assure yourself that you provide a destination
  1279.                 !! string of (at least) 5 bytes in order to avoid overwriting
  1280.                 !! any data (or WORSE executable program code !) in memory !
  1281.  
  1282.                 Call:        AH = 1Fh
  1283.                              DX = <port number to manage>
  1284.                                   (0 to 7 for COM1: to COM8:).
  1285.                               Where: DI= Seg:Off of the 5 bytes string
  1286.                                    in which to store the errors flags.
  1287.                 Return:      AH = <Error code>
  1288.                                    0: No error (function treatment is Ok:
  1289.                                       AL reports the transmission errors...)
  1290.                                    5: Specified port is unknown.
  1291.                              AL = <Answer code>
  1292.                                    0: No transmission error until now.
  1293.                                    1: At least one intervening error since the
  1294.                                       last call to the function 7, 0Eh, 11h
  1295.                                       or 1Fh.
  1296.                                       Where: DI is the errors report flag...
  1297.                                 byte 1: Number of lost bytes in receipt by
  1298.                                         lack of room in the receipt buffer.
  1299.                                 byte 2: Number of overrun errors.
  1300.                                 byte 3: Number of parity errors.
  1301.                                 byte 4: Number of stop bit errors.
  1302.                                 byte 5: Number of break interrupts received
  1303.                                    An equal number to 255 indicates that there
  1304.                                    was at least 255 errors of specified type
  1305.                                    since the last call.
  1306.  
  1307.                                                                        19
  1308.  
  1309.         Function 20h: Request modem status signals, input signals (under-
  1310.                 function 0) and output signals (under-functions 1 and 2).
  1311.                 0 --> Reading the modem status: Ready ?, Clear_to_send ?,
  1312.                 Ringing ?, Porteuse (carriage) ?, recent(s) change(s) ?,
  1313.                 Delta on DSR, CTS, RI or/and DCD ?
  1314.                 !! ATTENTION: Assure yourself that you provide a destination
  1315.                 !! string of (at least) 10 bytes in order to avoid any
  1316.                 !! data or (WORSE !) program code overwriting in memory.
  1317.                 !! ATTENTION: The indication on the modem status signals
  1318.                 !! are certified only on the open ports. Otherwise, the
  1319.                 !! hard interrupt doesn't up-dates these modem signals !
  1320.                 1 and 2 --> Positioning the DTR, RTS and OUT1 signals
  1321.                 in accordance to the calling request.
  1322.  
  1323.                 Call:        AH = 20h
  1324.                              DX = <port number to manage>
  1325.                                   (0 to 7 for COM1: to COM8:).
  1326.                              AL = <code of under function>
  1327.                                    0: Ask the modem status signals.
  1328.                                       In this case only:
  1329.                                       DI= Seg:Off of the 10 bytes string in
  1330.                                       which to store the modem status flags.
  1331.                                    1: Set to 1 the signals indicated by DI
  1332.                                       (set concerned bits to 1 in order to
  1333.                                       request its activation).
  1334.                                    2: Set to 0 the signals indicated by DI
  1335.                                       (set concerned bits to 0 in order to
  1336.                                       request its extinction).
  1337.                                    For the under-functions 1 and 2, only the
  1338.                                    bits 0 (for DTR), 1 (for RTS) and 2 (for
  1339.                                    OUT1) of DI has a meaning. OUT2 could NOT be
  1340.                                    accessed (Cf the ANNEX explanation...).
  1341.                 Return:      AH = <Error code> (and AL=0)
  1342.                                    0: No error.
  1343.                                    1: Under-function unknown.
  1344.                                    5: Specified port unknown.
  1345.                               In return of the under-function 0 only:
  1346.                                 byte 1: Concerned serial port (recall).
  1347.                                         Return 0 to 7 for COM1: to COM8:.
  1348.                                 byte 2: Modem ready or not (DSR),
  1349.                                 byte 3: Authorized to send or not (CTS),
  1350.                                 byte 4: Detected ringing or not (RI),
  1351.                                 byte 5: Received carriage or not (DCD),
  1352.                                 byte 6: Existence of modified status since
  1353.                                         the last call to the function 19h.
  1354.                                         !! 2xN successive modifications
  1355.                                         !! achieved by the driver between
  1356.                                         !! 2 calls to 0Ah (via the interfacing)
  1357.                                         !! could nullify their effects
  1358.                                         !! and therefore make some signals
  1359.                                         !! appearing as invariable. From there
  1360.                                         !! the interest of the bytes 7 to 10.
  1361.                                 byte 7: Nb. of change(s) on DSR ?
  1362.                                 byte 8: Nb. of change(s) on CTS ?
  1363.                                 byte 9: Nb. of change(s) on RI ?
  1364.                                 byte 10: Nb. of change(s) on DCD ?
  1365.                                 For the bytes 2 to 6: 1 means "YES" (TRUE),
  1366.                                 and 0 indicates "NO" (FALSE value). The bytes
  1367.                                 7 to 10 returns the number of change(s)
  1368.                                 since the last call (values from 0 to 255).
  1369.  
  1370.                                                                        20
  1371.  
  1372.  
  1373.         Function 21h: Request if a hardware hand-shaking protocol is used
  1374.                 (RTS/CTS, DTR/DSR, RI, DCD or OUT1). Indicates the state in
  1375.                 which it is, and whether the transmits are authorized or not.
  1376.  
  1377.                 Call:        AH = 21h
  1378.                              DX = <port number to manage> (0 to 7..COM1: COM8:)
  1379.                              AL = <code of request>
  1380.                                    1..3 or >6: RTS/CTS protocol (by default).
  1381.                                    2: DTR/DSR protocol.
  1382.                                    4: Recognition of RI signal (=> Local).
  1383.                                    5: Recognition of DCD signal (=> Local).
  1384.                                    6: Recognition of OUT1 signal (=> Remote).
  1385.                 Return:      AH = <Error code>
  1386.                                    0: No error.
  1387.                                    5: Specified port is unknown.
  1388.                              AL = <Answer code>
  1389.                                     0: Protocol no used.
  1390.                                    'L': Protocol managed in <L>ocal mode.
  1391.                                    'E': Protocol managed in r<E>mote mode.
  1392.                                    'B': Protocol managed in <B>ilateral mode.
  1393.                                    !! 'L,' 'E' or 'B' to the only choice for
  1394.                                    !! the RTS/CTS and DTR/DSR protocols.'L' for
  1395.                                    !! RI and DCD, and 'E' for OUT1=COMPULSORY !
  1396.                              DI = <Value of control flag> (EXCEPT OUT1)
  1397.                                    0: FALSE= suspended transmits (or: OUT1).
  1398.                                    1: TRUE = possible transmits.
  1399.  
  1400.         Function 22h: Indicate to the driver if it must manage a hardware
  1401.                 hand-shaking protocol (RTS/CTS, DTR/DSR, both, RI, DCD
  1402.                 or OUT1...).
  1403.  
  1404.                 Call:        AH = 22h
  1405.                              DX = <port number to manage>
  1406.                                   (0 to 7 for COM1: to COM8:).
  1407.                              AL = <code of request>
  1408.                                    3: RTS/CTS and DTR/DSR.
  1409.                                    otherwise: like AL under the function 21h !
  1410.                              BH = <code of command>
  1411.                                     0: Disactivate Protocol(s) (by default).
  1412.                                     'L': Protocol in <L>ocal mode.
  1413.                                     'E': Protocol in r<E>mote mode.
  1414.                                     'B': Protocol in <B>ilateral mode.
  1415.                 Return:      AH = <Error code>
  1416.                                    0: No error.
  1417.                                    5: Specified port is unknown.
  1418.  
  1419.         Function 23h: Request if the software hand-shaking protocol Xon/Xoff
  1420.                 is used and, if it is the case, its working mode. Indicate
  1421.                 the state in which it is (authorized transmit or not). Specify
  1422.                 the codes used for Xon and Xoff, as well as the present number
  1423.                 of Xoff received and not acknowledged by consecutives Xon to
  1424.                 their arrival.
  1425.                 !! ATTENTION: Assure yourself that you provide an (at least) 5
  1426.                 !! bytes destination string in order to avoid any data or
  1427.                 !! (WORSE!) executable code overwriting in memory.
  1428.  
  1429.                 Call:        AH = 23h
  1430.                              DX = <port number to manage>
  1431.                                   (0 to 7 for COM1: to COM8:).
  1432.                               Where: DI= Seg:Off of the 5 bytes string
  1433.                                    in which to store the Xon/Xoff protocol's
  1434.                                    values.
  1435.  
  1436.                                                                        21
  1437.  
  1438.  
  1439.  
  1440.                 Return:      AH = <Error code>
  1441.                                    0: No error.
  1442.                                    5: Specified port is unknown.
  1443.                              AL = <Answer code>
  1444.                                    0:  "NO, Xon/Xoff is not used".
  1445.                                    1:  "YES, Xon/Xoff is used".
  1446.                                 byte 1: Code used for Xon.
  1447.                                 byte 2: Code used for Xoff.
  1448.                                 byte 3: Number of Xoff not acknowledged.
  1449.                                   Remain to 0 if Xon/Xoff, though active in
  1450.                                   local or bilateral mode, proves out to be
  1451.                                   useless due to a good synchronization
  1452.                                   between the 2 linked computers !
  1453.                                   This byte therefore reflects the degree of
  1454.                                   activity of Xon/Xoff protocol: there is
  1455.                                   indeed always more communicated Xoff than
  1456.                                   Xon as this hand-shaking must enter in work.
  1457.                                   If, by regular test of this byte,your program
  1458.                                   note a tendency to regular increase, your
  1459.                                   program is here-by informed that it should
  1460.                                   send less quickly its data because it
  1461.                                   probably runs on a greatly faster station
  1462.                                   that the remote site ! This slowing is not
  1463.                                   however vital to the safe guard of a good
  1464.                                   link.
  1465.                                   Note that this indicator is not reseted to 0
  1466.                                   but by the Xon/Xoff hand-shake setup function
  1467.                                 byte 4: Present status of the flow management
  1468.                                   flag (...is it Xon or Xoff) ?
  1469.                                 byte 5: Utilization mode of Xon/Xoff ?
  1470.                                     0: Protocol not used.
  1471.                                    'L': Protocol managed in <L>ocal.
  1472.                                    'E': Protocol managed in r<E>mote.
  1473.                                    'B': Protocol managed in <B>ilateral.
  1474.  
  1475.         Function 24h: Indicate to the driver if it must use Xon/Xoff.
  1476.                 Definition of the codes to use for Xon and Xoff.
  1477.  
  1478.                 Call:        AH = 24h
  1479.                              DX = <port number to manage>
  1480.                                   (0 to 7 for COM1: to COM8:).
  1481.                              AL = <code of command>
  1482.                                     0:  "NO, don't use Xon/Xoff !" (by default)
  1483.                                    'L': Use it in <L>ocal mode.
  1484.                                    'E': Use it in r<E>mote mode.
  1485.                                    'B': Use it in <B>ilateral mode.
  1486.                              BH = <code for Xon> (11h in standard)
  1487.                              BL = <code for Xoff> (13h in standard)
  1488.                                 Always specify the values of these codes, even
  1489.                                 though these values are "standards" !
  1490.                 Return:      AH = <Error code>
  1491.                                    0: No error.
  1492.                                    5: Specified port is unknown.
  1493.  
  1494.                                                                        22
  1495.  
  1496.         Function 25h: Reading of the critical section flag (i.e. "semaphore")
  1497.                 associated to the management of the specified port.
  1498.                 Note that this flag is essentially interesting for a process
  1499.                 activated by a hardware interrupt, the priority of which is
  1500.                 more elevated than the one used by the serial port; and this
  1501.                 when such a process wants to reach the hardware by itself
  1502.                 (the UART in the occurrence...).
  1503.                 "Is the specified port set as free ?"
  1504.  
  1505.                 Call:        AH = 25h
  1506.                              DX = <port number to manage>
  1507.                                   (0 to 7 for COM1: to COM8:).
  1508.                 Return:      AH = <Error code>
  1509.                                    0: No error.
  1510.                                    5: Specified port is unknown.
  1511.                              AL = <Answer code>
  1512.                                    0: "NO, Specified port is occupied".
  1513.                                    1: "YES, Specified port is free".
  1514.  
  1515.         Function 26h: Indicate the driver a user routine to activate with the
  1516.                 hardware interrupt associated to the specified port.
  1517.                 !! ATTENTION: Assure yourself on the disactivation of the
  1518.                 !! user routine before finishing the application program: as
  1519.                 !! its code could be eliminated from the RAM after the end of
  1520.                 !! the application, an elevated risk of crash exists otherwise.
  1521.                 !!   Do take all the using precautions associated to the
  1522.                 !! writing of an interrupt in order to develop your routine !
  1523.                 !!   It must be referenced as a "PROC FAR", i.e. it must finish
  1524.                 !! by a "RETF" assembler instruction.
  1525.                 !!   This routine will be called by the serial driver hardware
  1526.                 !! interrupt bound to the UART, after each of its activation.
  1527.                 !! It is protected against the recursives calls by the driver
  1528.                 !! itself; therefore you don't have to take care of this
  1529.                 !! possible problem. The AX, BX, CX and DX registers are
  1530.                 !! preserved before the call to the user routine.
  1531.  
  1532.                 Call:        AH = 26h
  1533.                              DX = <port number to manage>
  1534.                                   (0 to 7 for COM1: to COM8:).
  1535.                                   Where: DI=Seg:Off of the routine to activate.
  1536.                                   (If value is: DI=0000:0000, there won't be
  1537.                                   installation of any new routine...).
  1538.                 Return:      AH = <Error code>
  1539.                                    0: No error.
  1540.                                    5: Specified port is unknown.
  1541.                              If AH = 0:
  1542.                              AL = <Report>
  1543.                                    0: There was no user interrupt before.
  1544.                                    1: A user interrupt was already active, and
  1545.                                       has been replaced by your new "interrupt"
  1546.                              If AL = 1 to the return:
  1547.                                 ES:DI gives the pointer associated to the
  1548.                                 previous installed user routine...
  1549.                 Process-call: To the call of your function, the following
  1550.                               information are stored by the AL register:
  1551.                                 AL = <Last event deserved>
  1552.                                 It is the reason of the last hardware
  1553.                                 interrupt activation. The possible values are:
  1554.                                    0: Change of the modem status signal(s).
  1555.                                    2: Transmit a byte.
  1556.                                    4: Correct receipt of a new byte.
  1557.                                    6: Error on a received byte.
  1558.                                 The content of any other register must be
  1559.                                 considered as unpredictable.
  1560.  
  1561.                                                                        23
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.         Function 27h: Indicate the driver to disactivate the user routine.
  1568.  
  1569.                 Call:        AH = 27h
  1570.                              DX = <port number to manage>
  1571.                                   (0 to 7 for COM1: to COM8:).
  1572.                 Return:      AH = <Error code>
  1573.                                    0: No error.
  1574.                                    5: Specified port is unknown.
  1575.  
  1576.         Function 28h: Indicate the driver a special routine to activate as soon
  1577.                 as the STARCOMM interrupt 14h  (functions 06h and following...)
  1578.                 return an internal working error (i.e. when AH is not NULL to
  1579.                 the return).
  1580.                 !! ATTENTION: Same general writing instructions that for the
  1581.                 !! user interrupt routine.
  1582.                 !!   This routine is not protected against the re-entrance =>
  1583.                 !! Do not use any local user variable in order to preserve
  1584.                 !! the re-entrance (that must characterize ALL the It. 14h !).
  1585.  
  1586.                 Call:        AH = 28h
  1587.                               Where: DI= Seg:Off of the routine to activate.
  1588.                                (If  DI= 0000:0000, there won't be any
  1589.                                 activation of a new routine...).
  1590.                 Return:      AH = 0
  1591.                              AL = <Report>
  1592.                                    0: No previous user routine installed.
  1593.                                    1: A routine was already set, and it
  1594.                                       has just been replaced by the one
  1595.                                       specified.
  1596.                                    If AL=1 to the return:
  1597.                                    ES:DI gives the pointer associated to the
  1598.                                    previous routine that was installed before.
  1599.                 Process-call: To the call of your function, the following
  1600.                               information are stored:
  1601.                                AH = <Treatment error code>
  1602.                                     (see the summary in paragraph I-5...).
  1603.                                DX = <Port number addressed at the time of the
  1604.                                     error>
  1605.                                     (0 to 7 for COM1: to COM8:. It may not
  1606.                                     have any meaning for a 0, 1 or 13 error:
  1607.                                     this depends upon the express request that
  1608.                                     that lastly induced the error !).
  1609.                                 All other registers must be considered as
  1610.                                 unpredictable.
  1611.  
  1612.         Function 29h: Indicate the driver to disactivate the error handler.
  1613.  
  1614.                 Call:        AH = 29h
  1615.                 Return:      AX = 0
  1616.  
  1617.                                                                        24
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.         Function 2Ah: Control the locking of the driver presence in memory.
  1624.                 This function allows to ask and define the lock status: if the
  1625.                 locking is active, the installed driver may NOT be removed
  1626.                 from the RAM, as long as an un-locking call is not initiated.
  1627.                 (This corresponds to the error message "Un-installation
  1628.                 locked by an application program !" from the driver).
  1629.                   This possibility of STARCOMM must not be exploited but by
  1630.                 the communication applications programmers that are back-ground
  1631.                 working, or that - for a precise reason - doesn't want to take
  1632.                 any risks of seeing the driver to disappear from the memory
  1633.                 (after having executed COMMAND.COM as a son process in order
  1634.                 to open a DOS window for example !...). This function 2Ah thus
  1635.                 permits to bring a means of security in these executions. It
  1636.                 is therefore clear that it is necessary not to provide any
  1637.                 mean(s) to the operator/standard user of controlling himself
  1638.                 the STARCOMM locking from the DOS prompt !
  1639.                   REMARK: If N calls take place in order to provoke a locking,
  1640.                 N un-locking calls will be necessary in order to effectively
  1641.                 get the driver un-locked. This permits the pacific coexistence
  1642.                 between several programs that all use the 2Ah locking function!
  1643.                   Rem: Useless under SCLIB, this function is there unknown (in
  1644.                 return, AH=1 is then systematic).
  1645.  
  1646.                 Call:        AH = 2Ah
  1647.                              AL = <Code of under function>
  1648.                                    0: Locking status ?  (BL then un-useful).
  1649.                                    1: Set the locking as indicated by BL.
  1650.                              BL = <Locking status requested>
  1651.                                    0: FALSE=> Disactivate the locking.
  1652.                                    1: TRUE=> Activate the locking.
  1653.                              (DX = port number not compulsory !)
  1654.                 Return:      AH = <Error code>
  1655.                                    0: No error.
  1656.                                    1: under-function number unknown, or
  1657.                                       requested locking status is unknown
  1658.                                       (i.e. not compliant, i.e. <>0 and<>1 !)
  1659.                              AL = <Locking status>
  1660.                                   Only meaningful if AL=0 to the call and if
  1661.                                   there is no error reported via the AH
  1662.                                   register to the function return.
  1663.                                   0: FALSE=> No locking in progress.
  1664.                                   otherwise=> active locking, with a locking
  1665.                                   imbrication equal to the number returned by
  1666.                                   BL (1 up to 255 !).
  1667.  
  1668.                                                                        25
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.         Function 2Bh: Return the 8 characters string making the name of
  1675.                 the DEVICE DRIVER associated to STARCOMM when it is loaded
  1676.                 from the CONFIG.SYS.
  1677.  
  1678.                 Call:        AH = 2Bh
  1679.                               Where: DI= Seg:Off of the first byte of the
  1680.                                 string where to store the 8 expected bytes.
  1681.                                 !! ATTENTION: Assure to reserve a sufficient
  1682.                                 !! receiving space (i.e. at least 8 bytes) !
  1683.                 Return:      AH = <Error code>
  1684.                                    0: No error
  1685.                                   13: Driver is NOT loaded as a DEVICE DRIVER !
  1686.  
  1687.         Function 2Ch: Request (OR order) to the driver the physical serial
  1688.                 port number that is to be accessed by the logical DEVICE
  1689.                 DRIVER port.
  1690.                 This function remains without any effect if STARCOMM.EXE was
  1691.                 not loaded from CONFIG.SYS (that is: as a DEVICE DRIVER...) !
  1692.  
  1693.                 Call:        AH = 2Ch
  1694.                              DX = <port number to manage>, if AL=1 only.
  1695.                                   (0 to 7 for COM1: to COM8:).
  1696.                              AL = <Code of under function>
  1697.                                    0: What physical port is in use ?
  1698.                                    1: Set the logical port on the physical
  1699.                                       port specified by DX.
  1700.                 Return:      AH = <Error code>
  1701.                                    0: No error
  1702.                                    1: Under-function number unknown.
  1703.                                    5: Specified port is unknown !
  1704.                                       (Commutation o.k. if the port is included
  1705.                                       between 0 and 8, unknown otherwise).
  1706.                                   13: driver NOT loaded as a DEVICE DRIVER !
  1707.                               If AL=0 to the call (under-function 0), and
  1708.                               excepted in case of an error (we get AH=0 to the
  1709.                               return):
  1710.                              AL = <Physical serial port number used>
  1711.                                   (0 to 7 for COM1: to COM8:).
  1712.  
  1713.                                                                        26
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.         Function 2Dh: Control the working authorization of the serial commu-
  1720.                 -nication BIOS emulator.
  1721.  
  1722.                 Call:        AH = 2Dh
  1723.                              AL = <Code of under function>
  1724.                                    0: Activity of the BIOS emulator ?
  1725.                                    1: Set the BIOS emulator activity.
  1726.                              BL = <Activation command code>
  1727.                              BL doesn't have any sense if AL=1 to the call.
  1728.                                    0: Stopping the BIOS emulator.
  1729.                                    1: Activating the BIOS emulator.
  1730.                 Return:      AH = <Error code>
  1731.                                    0: No error
  1732.                                    1: Under-function number unknown.
  1733.                              AL = <Working of the emulator>
  1734.                                    AL is 0 if AL=1 to the call.
  1735.                                    0: BIOS emulator inactive.
  1736.                                    1: BIOS emulator active.
  1737.  
  1738.         Function 2Eh: Control of the computer architectural type flag. The
  1739.                 interest concerns the access to the IRQ that is function of
  1740.                 the computer type.
  1741.                 Note that this recognition is normally fully automatic !
  1742.                 All arbitrary modification must not be made excepted in
  1743.                 ACQUAINTANCE of a reason !...
  1744.  
  1745.                 Call:        AH = 2Eh
  1746.                              AL = <Under-function code>
  1747.                                    0: Recognized type for the computer ?
  1748.                                    1: Force the definition of the type.
  1749.                              BL = <Type code>
  1750.                                    BL does have sense only when AL=1 to
  1751.                                    the call:
  1752.                                    1: PC Type     2: XT Type     3: AT Type
  1753.                 Return:      AH = <Error code>
  1754.                                    0: No error
  1755.                                    1: Under-function number unknown.
  1756.                              AL = <Computer type currently acknowledged>
  1757.                               AL is 0 if AL=1 to the call.
  1758.                               1: PC, 2: XT, 3: AT, 4: PS/2-non AT, 5: PS/2-AT
  1759.  
  1760.                                                                        27
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.       2- Definition of the procedures interfacing to the PASCAL and to the C:
  1767.       ───────────────────────────────────────────────────────────────────────
  1768.       With the C or PASCAL languages, use the procedures provided in the
  1769.     STARINTF files (.C or .PAS) in order to reach to the serial port(s)
  1770.     in using SERIAL PORTS MANAGER's STARCOMM driver.
  1771.       For the Turbo-Pascal(C) language, TESTSTAR.PAS is to your disposal
  1772.     as a demonstration program.
  1773.       For the C language, you could study TERMINAL.C.
  1774.  
  1775.      ────────────────────-
  1776.        Global variables:
  1777.      ────────────────────-
  1778.      RS_accessible: Boolean (byte in C) indicating whether the driver was found
  1779.                     in memory (TRUE/1) or not (FALSE/0), this to the level
  1780.                     of the interrupt 14h interfacing.
  1781.      BasePort1 to BasePort4:
  1782.                     Addresses of the first UART registers associated to each
  1783.                     serial port from COM1: to COM4:. The values kept
  1784.                     in these variables are the standards addresses by default
  1785.                     (COM1:03F8h, COM2:02F8h, COM3:03E8h, and COM4:02E8h...).
  1786.                     They are up-dated according to the addresses memorized
  1787.                     by the BIOS (situated in 40:00 to 40:08 hexa.) when
  1788.                     the "Get_ports_Adresses" procedure is called. Remember
  1789.                     that the driver of SERIAL PORTS MANAGER sets this last
  1790.                     memory zone in conformity with the addresses that it uses
  1791.                     for the serial ports. Therefore the call to
  1792.                     "Get_Ports_Adresses" allows to assure of the consistency
  1793.                     between your application and the serial driver.
  1794.                     When a serial port number I doesn't physically exists, the
  1795.                     value of "BasePortI" is 0.
  1796.      RTS_CTS, DTR_DSR, BothCmde, RI, DCD, and OUT1:
  1797.                     Possible values for the parameter "Proto_type" of the
  1798.                     functions "HandShake_Status" and "HandShake_Setup" that
  1799.                     controls the activity of the hardware hand-shaking.
  1800.      Inactive, Local, Eloigne (=remote), Bilateral:
  1801.                     Different working modes recognized by the hand-shaking
  1802.                     protocols. Correspond to the code L, E, and B of
  1803.                     the '/LC', '/EC', ... options.
  1804.      Xon, Xoff:     Two bytes giving the codes to use in order to apply
  1805.                     the Xon/Xoff protocol. These codes have the respective
  1806.                     following values by default: 11h and 13h. It is the
  1807.                     functions "XonoffShaking_Status" and "Xonoff Shaking_setup"
  1808.                     that uses these constants/variables.
  1809.                     Changing the values of these 2 constants, could alter the
  1810.                     software hand-shaking exploited: in order to establish
  1811.                     an ACK/ETX hand-shaking for example, initializes Xon to
  1812.                     06h and Xoff to 03h...
  1813.      NonActif, Replaces, RempNULL:
  1814.                     Possibles working modes for the substitution process of
  1815.                     the deficient bytes in receipt. Report to the "Function
  1816.                     13h" higher for more precision on this process. These
  1817.                     values are used by the functions "Status_Trait_Erreurs"
  1818.                     and "Def_Trait_Erreurs".
  1819.      NoBreakBuff, BreakOnBuff:
  1820.                     Possibles working modes for the Break substitution process
  1821.                     used to represent,in the receipt buffer,the BREAK received.
  1822.      Type_PC, Type_XT, Type_AT, PS2_PC, PS2_AT:
  1823.                     Possible types of known computer architectures.
  1824.  
  1825.                                                                        28
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.        For the PASCAL, a variable indicates the type of the present driver in
  1832.      RAM memory:
  1833.        type_driver: byte that permits to know what driver is loaded in memory:
  1834.                     0=No driver, 1=STARCOMM is BIOS present, 2= STARCOMM is
  1835.                     loaded as a DEVICE DRIVER.
  1836.        This variable is automatically up-dated by the STARINTF.PAS library
  1837.      that calls "Check_STARCOMM_Present" since its very first utilization.
  1838.        An another variable permits the calling program to specify to which
  1839.      serial port it addresses its commands: this variable therefore has to be
  1840.      initialized BEFORE any comm. function call (value between 0 and 7 for
  1841.      COM1: to COM8:):
  1842.        CommPort:    port concerned by the called function.
  1843.        A boolean array allows to mark the acknowledged and supported driver
  1844.      ports (values up-dated when the "COMM_Opened" function is called !):
  1845.        ComExist[0..7] ...  (ComExist[0]= TRUE if COM1: exist, etc...)
  1846.  
  1847.        In C, some other variables are to be considered as globals in order to
  1848.      gain access to all the possibly needed informations:
  1849.        Format        : Current communication format.
  1850.        Pret          : Status of "Modem Ready" signal (i.e. DTR)
  1851.        Clear_to_send : Status of CTS signal.
  1852.        Sonnerie      : Status of RI signal.
  1853.        Porteuse      : Status of DCD signal.
  1854.        dDSR          : Change(s) of the DSR status since the last call.
  1855.        dCTS          : Change(s) of the CTS status...
  1856.        dRI           : Change(s) of the RI status...
  1857.        dDCD          : Change(s) of the DCD status...
  1858.        Buff_overflow : Number of lost bytes in receipt by lack of room
  1859.                        in the receipt buffer.
  1860.        Engorgement   : Number of overrun errors.
  1861.        Parity        : Number of parity errors.
  1862.        Stop_bit      : Number of stop-bit errors.
  1863.        Break_it      : Number of intervening 'break-interrupt' in receipt.
  1864.        CommPort and ComExist[0..7] are also defined for the C language.
  1865.        "type_driver" is not, on the other hand, defined (it is necessary to
  1866.        call oneself "Check_STARCOMM_Present" in C !).
  1867.  
  1868.                                                                        29
  1869.  
  1870.      ──────────────────────────────────-
  1871.        Available procedures/functions:
  1872.      ──────────────────────────────────-
  1873.      Check_STARCOMM_Present:
  1874.        Indicates if the SERIAL PORTS MANAGER driver is present in memory.If the
  1875.        case occurs, up-dates the global variables of the interfacing to the
  1876.        advance language. CALL THIS function in order to initialize the driver
  1877.        use (excepted in PASCAL for which this call is automatic thanks to the
  1878.        ".TPU" UNIT file structure...).
  1879.      Version:
  1880.        Returns the ASCII number of the loaded driver version.
  1881.      Open_Port and OpenPort_Buff:
  1882.        Provokes the opening of the serial port specified by the "CommPort"
  1883.        variable and sets to 1 the DTR and OUT2 modem control signals. Resets
  1884.        to 0 the errors flags concerning the link when there are no
  1885.        indicated errors in return.
  1886.        "Open_Port" provokes the utilization of one of the internal buffers
  1887.        pairs available to the driver, whereas "OpenPort_Buff" allows to
  1888.        associate external memory buffers to a port (this offering a more
  1889.        flexible exploitation !).
  1890.      Close_Port:
  1891.        Provokes the closing of the port specified by "CommPort", and the reset
  1892.        to 0 of the modem control signals (when the closing is possible !).
  1893.      Port_Opened:
  1894.        Returns TRUE (value 1 in C) if the designated port is opened,
  1895.        and FALSE (0 in C) if the port is closed.
  1896.      Interdit_Port:
  1897.        Permits to forbid the access to the "CommPort" serial port. Its
  1898.        initializations are restored and the port is closed before its access
  1899.        gets forbidden.
  1900.      Autorise_Port:
  1901.        Permits to allow the access to the "CommPort" port if we detect it
  1902.        points to a usable UART. Otherwise the port remains forbidden !
  1903.      EtatVerrouilleComm et VerrouilleComm:
  1904.        Controls the locking of the speeds and formats of the serial ports.
  1905.      SLOW_Ems:
  1906.        Initializes the slow transmit on the designated "CommPort" port,
  1907.        without modifying the activity status of this port.
  1908.      FAST_Ems:
  1909.        Initializes the fast transmit on the designated "CommPort" port,
  1910.        without modifying the activity status of this port.
  1911.      Send_SLOW:
  1912.        Information on the transmission mode in progress on the "CommPort" port.
  1913.      Get_Ports_Adresses:
  1914.        Get the UART basis addresses in the BIOS "mail box" (Ports 0 to 3).
  1915.      Infos_Uart:
  1916.        Permits to know, for every port, the type of used UART, its address,
  1917.        the hard interrupt associated to it and, if it has a FIFO buffer,
  1918.        the use made of this internal buffer.
  1919.      Set_New_Uart:
  1920.        Permits the address, the IRQ and the authorized exploitation of a FIFO
  1921.        to be reseted for one port of STARCOMM. New parameters are not acknow-
  1922.        -ledged if no UART is found to the specified address. An un-supported
  1923.        IRQ is not acknowledged too (without return of an error code in this
  1924.        last case...).
  1925.      Infos_Buffs:
  1926.        Informations on the sizes and the use status of the serial communication
  1927.        driver internals buffers.
  1928.      Init_Port:
  1929.        Resets the specified communication port and resets to 0 the comm. errors
  1930.        flags (Cf. Change_com_port below...).
  1931.        Informations on the transmission buffers sizes.
  1932.      Init_status:
  1933.        Returns the initialization format of the "CommPort" port.
  1934.  
  1935.                                                                        30
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.      Reset_Init_Status:
  1942.        Reactivates the format indicated on the "CommPort" port.
  1943.      Flush_buffers:
  1944.        Emptiness the 2 communication buffers (input And output) and resets
  1945.        to 0 the transmit errors flags.
  1946.      Flush_InBuff:
  1947.        Resets the receipt port, and empties the receipt buffer.
  1948.      Flush_OutBuff:
  1949.        Resets the transmit port, and empties the transmit buffer.
  1950.      ResetCOM_and_TimMAX:
  1951.        Resets the complete communication link, and allows to specify the driver
  1952.        the maximum time-out limits for the reading and writing process. The
  1953.        values of time-out used before the possible change are returned to the
  1954.        calling program.
  1955.      Change_com_port:
  1956.        Changes the used serial port (0 to 7 = COM1: to COM8:), if the specified
  1957.        port is acceptable.
  1958.        Resets to 0 the communication errors flags if the new port is really
  1959.        active.
  1960.        In this case, all the ports are disactivated EXCEPT the one specified.
  1961.      Attend_Buff_ems_vide:
  1962.        Loop until the specified port's transmit buffer gets empty or until
  1963.        the time-out occurs (provided that the port is opened !).
  1964.      CheckBufferIn:
  1965.        Is there any byte to read from receipt buffer ?
  1966.      CheckBufferOut:
  1967.        Could we place some bytes to send in the transmit buffer ?
  1968.      ReadSerie:
  1969.        Read N byte(s) from the receipt buffer.
  1970.      WriteSerie:
  1971.        Transmit N byte(s) to the port, using its transmit buffer.
  1972.      ReadCarSerie:
  1973.        Read a byte from the receipt buffer, without any expectation.
  1974.      WriteCarSerie:
  1975.        Write a byte to the transmit buffer, without any expectation.
  1976.      Peek_rcp:
  1977.        Read the next available byte (if it exists !) from the receipt buffer,
  1978.        without making it to disappear from the buffer.
  1979.      Poke_rcp:
  1980.        Write a byte to the next available entrance of the receipt buffer
  1981.        (this simulates a receipt of this character). ATTENTION: the
  1982.        hand-shaking is managed by this function if it is active: "Poke_rcp"
  1983.        fully simulates the work of the receipt hard interrupt !...
  1984.      WriteCmde:
  1985.        Directly send a N byte(s) string to the serial port used, in
  1986.        momentarily interrupting the standard buffered transmission, this
  1987.        in order not to destroy the string. The flow management codes are
  1988.        not considered by this specific sending process.
  1989.        Utilite: Sending some specific commands to your MODEM (and in fact
  1990.        to all type of particular device attached to your serial port, and
  1991.        able to interpret any particular protocol...).
  1992.      Status_Trait_Erreurs:
  1993.        Request the present substitution process working status.
  1994.  
  1995.                                                                        31
  1996.  
  1997.  
  1998.  
  1999.      Def_Trait_Erreurs:
  2000.        Management of the substitution process for the erroneous received bytes.
  2001.      Etat_du_Modem:
  2002.        Return the modem status signals associated with the active serial port.
  2003.        set_DTR, clear_DTR, set_RTS, clear_RTS, set_OUT1 and clear_OUT1:
  2004.        Set (or clear) the modem control signal ('set'= 'set to 1' and
  2005.        'clear'= 'set to 0'...).
  2006.      Send_break:
  2007.        Send a break interrupt via the used serial port.
  2008.      Errors_Report:
  2009.        Was there any bytes transmission errors since the last call to the
  2010.        "Errors_Report" function ?
  2011.        If yes: Nature and number of these errors (for every type of them) ?
  2012.      Port_Free:
  2013.        Can we read or write to the port managed by the driver, without inter-
  2014.        fearing with its work ? (i.e. Is the driver hardware interrupt in
  2015.        progress on the specified port ?).
  2016.      HandShake_Status:
  2017.        Are RTS/CTS or DTR/DSR used ? In what working mode ?
  2018.        Are the transmits currently allowed ? Idem for RI, DCD and OUT1.
  2019.      HandShake_setup:
  2020.        Defined the activity status of RTS/CTS, DTR/DSR, RI, DCD, OUT1 as
  2021.        indicated.
  2022.      XonoffShaking_Status:
  2023.        Is Xon/Xoff used ? Are the transmits currently allowed ?
  2024.        What mode of working is active ?
  2025.        What are the values used in order to code Xon and Xoff ?
  2026.        Number of received Xoff without ulterior discharge by some Xon ?
  2027.      XonoffShaking_setup:
  2028.        Set the Xon/Xoff activity status as indicated.
  2029.      Set_routine (and Reset_routine in PASCAL):
  2030.        Install and activate a user routine to call at the time of each
  2031.        serial port hardware interrupt (but the transmits when the slow
  2032.        transmission mode is used...).
  2033.      Unset_routine:
  2034.        Disactivate the user routine.
  2035.      Set_err_routine (and Reset_err_routine in PASCAL):
  2036.        Install and activate a routine to manage the Interrupt 14h errors. To
  2037.        be created without any variable and without call(s) to the Int. 21h
  2038.        in order to protect the general re-entrance of the interrupt 14h !
  2039.      Unset_err_routine:
  2040.        Disactivate the interrupt 14h errors management routine.
  2041.      Lock:
  2042.        Driver un-installation is forbidden.
  2043.      Unlock:
  2044.        Driver un-installation is authorized.
  2045.      GetPortName:
  2046.        Permits to know the name used by STARCOMM when it is used as a DEVICE
  2047.        DRIVER (this name may be defined as needed: cf. the "/ND=[xxxxxxxx]"
  2048.        option explained in the chapter III).
  2049.      GetPortDevice:
  2050.        Get the number of the physical serial ports interfaced by the file
  2051.        "COMM:". (Answer without any meaning if STARCOMM.EXE was installed
  2052.        in BIOS mode !)
  2053.      ResetPortDevice:
  2054.        Request to the "COMM:" file to work with the physical serial port
  2055.        specified by the "CommPort" variable. (Remains without effect if
  2056.        STARCOMM.EXE works in BIOS mode !)
  2057.      EmulBIOS (/SetEmulBIOS):
  2058.        Request(/define) the BIOS emulator activity status.
  2059.      OrdiType (/SetOrdiType):
  2060.        Request(/define) the used computer type (PC, XT, PS/2 or AT...).
  2061.  
  2062.                                                                        32
  2063.  
  2064.  
  2065.  
  2066.       3- Description of the procedures interfacing to the PASCAL:
  2067.       ───────────────────────────────────────────────────────────
  2068.        Prototype:   PROCEDURE|FUNCTION <name>[(<ARGUMENT(S)>)][:<type>];
  2069.        ----------    Call:   - Global call variables
  2070.                              - Call parameters
  2071.                      Return: - Global return variable
  2072.                              - Return parameters
  2073.                              - Functions return codes
  2074.  
  2075.         FUNCTION Check_STARCOMM_Present: BYTE;
  2076.                 Call:    <Nothing>
  2077.                 Return:  "RS_accessible" to TRUE if a driver is present.
  2078.                          0= no driver, 1= STARCOMM loaded in BIOS mode,
  2079.                          2= STARCOMM loaded as a DEVICE DRIVER.
  2080.  
  2081.         PROCEDURE Version(VAR NumVer: Chn4bytes);
  2082.                 Call:    <Nothing>
  2083.                 Return:  "NumVer" contains the driver version in ASCII.
  2084.  
  2085.         FUNCTION Open_Port: BYTE;
  2086.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2087.                 Return: 0 if the port could be opened.
  2088.                         5 if the port is unknown.
  2089.                         8 if the port was already open.
  2090.                         9 if the port doesn't dispose of buffers.
  2091.  
  2092.         FUNCTION OpenPort_Buff(Segment, Offsets, Taille_in, Taille_out: WORD):
  2093.                 BYTE;
  2094.                 Call:   idem preceding+ Seg:Ofs of the buffers and their sizes!
  2095.                 Return: idem preceding except 9= "overflowed segment !"
  2096.  
  2097.         FUNCTION Close_Port(ProtegeBuff: BOOLEAN): BYTE;
  2098.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2099.                         "ProtegeBuff" to TRUE if the buffer of transmit must be
  2100.                         emptiness before closing the port, to FALSE otherwise.
  2101.                 Return: 0 if the port could be closed.
  2102.                         5 if the port is unknown.
  2103.                         7 if it still remains bytes to send (in this case, the
  2104.                           port is still opened), if "ProtegeBuff" to TRUE.
  2105.                        10 if it is impossible to recover the associated buffer.
  2106.  
  2107.         FUNCTION Port_Opened: BOOLEAN;
  2108.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2109.                 Return: TRUE if the port is opened, FALSE otherwise.
  2110.  
  2111.         FUNCTION Interdit_Port: BYTE;
  2112.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2113.                 Return: 0 if the port could be correctly closed.
  2114.                         10 if the "CommPort" buffers pair is lost.
  2115.                         The access to the port is forbidden in both cases.
  2116.  
  2117.         FUNCTION Autorise_Port: BYTE;
  2118.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2119.                 Return: 0 if the access to the port could be authorized.
  2120.                         5 if the port doesn't designate a usable UART (the
  2121.                           access to the port then remains forbidden).
  2122.  
  2123.                                                                        33
  2124.  
  2125.  
  2126.         FUNCTION  EtatVerrouilleComm(VAR Mode: BYTE): BYTE;
  2127.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2128.                 Return: 0 if the port is known.
  2129.                         5 if the port is not known.
  2130.                         "Mode" worth 2 to 5 upon the locking status in use
  2131.                         (see next function for precise decoding of this...).
  2132.  
  2133.         FUNCTION  VerrouilleComm(Mode: BYTE): BYTE;
  2134.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2135.                         "Mode" worth 2 to authorise any change, 3 to lock
  2136.                         the speed, 4 to lock the format or 5 to lock both.
  2137.                 Return: 0 if the port is known and the work done.
  2138.                         5 if the port is not known.
  2139.  
  2140.         FUNCTION SLOW_Ems: BYTE;
  2141.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2142.                 Return: 5 if the port is unknown.
  2143.  
  2144.         FUNCTION FAST_Ems: BYTE;
  2145.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2146.                 Return: 5 if the port is unknown.
  2147.  
  2148.         FUNCTION Send_SLOW: BOOLEAN;
  2149.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2150.                 Return: Return TRUE if the designated port is in slow transmis-
  2151.                         -sion mode,FALSE if it works in fast transmission mode.
  2152.  
  2153.         PROCEDURE Get_Ports_Adresses;
  2154.                 Call:   <Nothing>
  2155.                 Return: "BasePort1" to "BasePort4" are up-dated.
  2156.  
  2157.         FUNCTION Infos_Uart(VAR Uart_type: BYTE; VAR Uart_adresse: WORD;
  2158.                 VAR Irq, FIFO_actif, Taille_FIFO: BYTE): BYTE;
  2159.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2160.                 Return: 0 or 5: the parameters are informed
  2161.                         (5 if the port is considered as unknown).
  2162.  
  2163.         FUNCTION Set_New_Uart(Uart_adresse: WORD; Irq, FIFO_actif, Taille_FIFO:
  2164.                  BYTE): BYTE;
  2165.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2166.                         "Uart_adresse" <- value of the new address,
  2167.                         "Irq"          <- value 2,3,4,5,7,10,11,12 or 15
  2168.                         "FIFO_actif"   <- 0=NO, 1=YES
  2169.                         "Taille_FIFO"  <- from 2 to 15 bytes
  2170.                 Return:  0 achieved modifications,
  2171.                          5 if the port is unknown,
  2172.                         11 if the port is opened (the port must be closed
  2173.                            for modifying its physical parameters),
  2174.                         12 if the address reveals itself incorrect.
  2175.  
  2176.         PROCEDURE Infos_Buffs(VAR Nb_utils, Nb_maxi: BYTE;
  2177.                 VAR Taille_InBuff: WORD; VAR Taille_OutBuff: WORD);
  2178.                 Call:   <Nothing>
  2179.                 Return: The parameters are informed.
  2180.  
  2181.                                                                        34
  2182.  
  2183.  
  2184.  
  2185.         FUNCTION Init_Port(length, stop_bit, parity: CHAR; speed:
  2186.                 LONGINT; VAR Taille_InBuff: WORD; VAR Taille_OutBuff: WORD):
  2187.                 BYTE;
  2188.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2189.                         "length"   = '5,' '6,' '7,' or '8' bits,
  2190.                         "stop_bit" = '1' or '2,'
  2191.                         "parity"   = 'N','P','I','T' or 'R' for <N>o parity,
  2192.                                <P> even, <I> Odd,<T> mark, or <R> unmark,
  2193.                         speed={110,150,300,600,1200,2400,4800,9600,19200,
  2194.                               28800,38400,57600,115200} bits/second.
  2195.                 Return: "Taille_InBuff"= Size of receipt buffer.
  2196.                         "Taille_OutBuff"= Size of transmit buffer.
  2197.                         (These 2 numbers must gives the bytes number).
  2198.                         1 if incorrect parameters (error=TRUE),
  2199.                         0 (FALSE) otherwise.
  2200.  
  2201.         PROCEDURE Init_status(VAR Format: WORD);
  2202.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2203.                 Return: "Format" variable is up-dated.
  2204.  
  2205.         FUNCTION Reset_Init_status(Format: WORD): BYTE;
  2206.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2207.                         "Format" specifies the reset value to use.
  2208.                 Return: 0 (OK!) or 2 (no driver).
  2209.                         5 if the port is unknown.
  2210.  
  2211.         PROCEDURE Flush_buffers;
  2212.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2213.                 Return: <Nothing>
  2214.  
  2215.         PROCEDURE Flush_InBuff;
  2216.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2217.                 Return: <Nothing>
  2218.  
  2219.         PROCEDURE Flush_OutBuff;
  2220.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2221.                 Return: <Nothing>
  2222.  
  2223.         PROCEDURE ResetCOM_and_TimMAX(RdTim_MAX: BYTE; VAR Old_RdTim_MAX:BYTE;
  2224.                 WrTim_MAX: BYTE; VAR Old_WrTim_MAX: BYTE);
  2225.                 Call:   "CommPort" designates the concerned port (0 to 7);
  2226.                         "RdTim_MAX" and "WrTim_MAX" must be included between
  2227.                         the ASCII values '0' and '9' in order to define a maxi.
  2228.                         treatment expectation (in reading or writing) included
  2229.                         between ½ and 9 seconds. After the maximum time limit
  2230.                         thus defined, the reading or writing procedure will
  2231.                         abort, indicating a "TIME-OUT" error. (The concerned
  2232.                         procedures are "ReadSerie" and "WriteSerie").
  2233.                 Return: Up-dating of the variable indicated as parameters.
  2234.                         "Old_RdTim_MAX" and "Old_WrTim_MAX" returns the values
  2235.                         used before the possible induced change by this call to
  2236.                         the procedure. Note that a value of 0 placed in
  2237.                         "RdTim_MAX" and/or "WrTim_MAX" to the call of the
  2238.                         PROCEDURE will make that there won't be modification of
  2239.                         the current values for the time-out values used by the
  2240.                         driver. The in return variables "Old_RdTim_MAX" and
  2241.                         "Old_WrTim_MAX" will however correctly be informed.
  2242.  
  2243.                                                                        35
  2244.  
  2245.  
  2246.  
  2247.         FUNCTION Change_com_port(port: BYTE): BYTE;
  2248.                 Call:   "port"= N° of only port to keep opened (0 to 7 for
  2249.                         COM1: to COM8:).
  2250.                         "CommPort" is up-dated in return.
  2251.                 Return: FALSE if the port was not opened yet, TRUE in the
  2252.                         other case.
  2253.  
  2254.         FUNCTION Attend_Buff_ems_vide(Temps_maxi: BYTE): BOOLEAN;
  2255.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2256.                         "Temps_maxi": 0 to 255 half a second expectation, to
  2257.                         the pleased (that is: maxi. admissible waiting time !).
  2258.                 Return: TRUE if the transmit buffer is (finally) emptiness,
  2259.                         FALSE if the maximum expectation is reached.
  2260.  
  2261.         FUNCTION CheckBufferIn(VAR nb_a_lire: WORD): BOOLEAN;
  2262.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2263.                 Return: "Nb_a_lire"= Nb. of byte(s) present(s) in receipt.
  2264.                         FALSE: the BuffIn is emptiness; TRUE otherwise.
  2265.  
  2266.         FUNCTION CheckBufferOut(VAR place_libre: WORD): BOOLEAN;
  2267.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2268.                 Return: "place_libre"= Nb. of free byte(s) in the output buff.
  2269.                         TRUE: BuffOut has room; FALSE otherwise.
  2270.  
  2271.         FUNCTION ReadSerie(VAR c: CHAR; number: WORD;
  2272.                           VAR Nb_received: WORD): BYTE;
  2273.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2274.                         "c"= First byte in order to store the 'string' to
  2275.                         receive, "number"= Nb. of byte(s) to read.
  2276.                 Return: "Nb_received"= Nb. of byte(s) really read.
  2277.                         0 if the reading of byte(s) appeared correct
  2278.                         2 if the receipt is incorrect (Time-out).
  2279.                         5 if the port is unknown.
  2280.  
  2281.         FUNCTION WriteSerie(VAR c: CHAR; number: WORD;
  2282.                            VAR Nb_written: WORD): BYTE;
  2283.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2284.                         "c"= First byte of the 'string' to send,
  2285.                         "number"= Nb. of byte(s) making the 'string'.
  2286.                 Return: "Nb_written"= Nb. of byte(s) effectively written.
  2287.                         0 if the writing of byte(s) appeared correct,
  2288.                         3 if you asked to send no byte (!),
  2289.                         4 if a time-out occurred in writing.
  2290.                         5 if the port is unknown.
  2291.  
  2292.         FUNCTION ReadCarSerie(VAR c: CHAR): BYTE;
  2293.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2294.                 Return: "c" = byte received,
  2295.                         0 if the reading of the byte appeared possible,
  2296.                         3 if no byte is available or if the port is closed,
  2297.                         5 if the port is unknown.
  2298.  
  2299.         FUNCTION WriteCarSerie(c: CHAR): BYTE;
  2300.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2301.                         "c"= byte to send.
  2302.                 Return: 0 if the writing of the byte appeared possible,
  2303.                         3 if this byte couldn't be written (full buffer or
  2304.                         port closed),
  2305.                         5 if the port is unknown.
  2306.  
  2307.                                                                        36
  2308.  
  2309.  
  2310.  
  2311.         FUNCTION Peek_rcp(VAR c: CHAR): BYTE;
  2312.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2313.                 Return: "c" = read byte,
  2314.                         0 if the reading of the byte appeared possible,
  2315.                         3 if no byte is available or if the port is closed,
  2316.                         5 if the port is unknown.
  2317.  
  2318.         FUNCTION Poke_rcp(c: CHAR): BYTE;
  2319.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2320.                         "c"= byte to insert in the buffer of receipt.
  2321.                 Return: 0 if the writing of the byte appeared possible,
  2322.                         3 if this byte couldn't be written (full buffer or
  2323.                         port closed),
  2324.                         5 if the port is unknown.
  2325.  
  2326.         FUNCTION WriteCmde(VAR Cmde: CHAR;number: BYTE;UseDTR: BOOLEAN): BYTE;
  2327.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2328.                         "Cmde"= first byte of the control to send,
  2329.                         "number"= Nb. of byte(s) making this command.
  2330.                         "UseDTR"= Set DTR in order to frame the orders
  2331.                         addressed to the device ?
  2332.                 Return: 0 if the writing of byte(s) appeared correct,
  2333.                         2 if no byte was provided to be sent !
  2334.                         5 if the port is unknown.
  2335.  
  2336.         PROCEDURE Status_Trait_Erreurs(VAR mode: BYTE;VAR codeEr,codeBk: CHAR);
  2337.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2338.                 Return: "mode" = substitution mode used. {"NonActif",
  2339.                         "Replaces", "RempNULL", "NoBreakBuff", "BreakOnBuff"}
  2340.                         "codeEr"= byte of replacement for the deficient bytes
  2341.                         to currently use.
  2342.                         "codeBk"= byte of replacement for the Break into buffer
  2343.  
  2344.         FUNCTION Def_Trait_Erreurs(mode: BYTE; code: CHAR): BOOLEAN;
  2345.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2346.                         "mode"= substitution mode to activate. {"NonActif",
  2347.                         "Replaces", "RempNULL", "NoBreakBuff", "BreakOnBuff"}
  2348.                         "code"= byte of replacement for the deficient bytes.
  2349.                 Return: Return FALSE if the "mode" is acknowledged by
  2350.                         the driver, TRUE ("there is an error !") otherwise.
  2351.  
  2352.         PROCEDURE Etat_du_Modem(VAR Voie_active: CHAR; VAR Pret,
  2353.                 Clear_to_send, Sonnerie, Porteuse, Changes, dDSR,
  2354.                 dCTS, dRI, dDCD: BOOLEAN);
  2355.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2356.                 Return: "Voie_active": '1' for the COM1:, '2' for the COM2:,
  2357.                         '3' for the COM3:, '4' for the COM4:, etc...
  2358.                         Other variable: TRUE value (code 1) or FALSE (code 0)
  2359.                         ("Pret", "Clear_to_send", "Sonnerie", "Porteuse",
  2360.                         "Changes", "dDSR", "dCTS", "dRI", "dDCD").
  2361.  
  2362.         PROCEDURE set_DTR;
  2363.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2364.                 Return: <Nothing>
  2365.  
  2366.         PROCEDURE clear_DTR;
  2367.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2368.                 Return: <Nothing>
  2369.  
  2370.                                                                        37
  2371.  
  2372.  
  2373.  
  2374.         PROCEDURE set_RTS;
  2375.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2376.                 Return: <Nothing>
  2377.  
  2378.         PROCEDURE clear_RTS;
  2379.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2380.                 Return: <Nothing>
  2381.  
  2382.         PROCEDURE set_OUT1;
  2383.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2384.                 Return: <Nothing>
  2385.  
  2386.         PROCEDURE clear_OUT1;
  2387.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2388.                 Return: <Nothing>
  2389.  
  2390.         PROCEDURE Send_break(length: BYTE);
  2391.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2392.                         "length" of the break interrupt signal between 0
  2393.                         and 250 eighteenth of a second.
  2394.                 Return: <Nothing>
  2395.  
  2396.         FUNCTION Errors_Report(VAR Buff_overflow, Engorgement, Parite,
  2397.                 Stop_bit, Break_it: BYTE): BOOLEAN;
  2398.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2399.                 Return: "Buff_overflow", "Engorgement", "Parite", "Stop_bit",
  2400.                         and "Break_it" are all up-dated.
  2401.                         TRUE: at least one error took place since the last
  2402.                         call to this function; FALSE if not...
  2403.  
  2404.         FUNCTION Port_Free: BOOLEAN;
  2405.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2406.                 Return: TRUE if we could reach the COM:, FALSE otherwise.
  2407.  
  2408.         FUNCTION HandShake_Status(Proto_type: BYTE; VAR SendEnabled: BOOLEAN):
  2409.                 BYTE;
  2410.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2411.                         "Proto_type": RTS_CTS, DTR_DSR, RI, DCD or OUT1.
  2412.                 Return: "SendEnabled"= TRUE if the transmit is authorized.
  2413.                         'Inactif': protocol or specified signal not used.
  2414.                         Otherwise: the protocol or signal is used in the
  2415.                         mode indicated in return ('Local,' 'Eloigne'(=remote)
  2416.                         or 'Bilateral').
  2417.  
  2418.         PROCEDURE HandShake_Setup(Proto_type: BYTE; VAR state: BYTE);
  2419.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2420.                         "Proto_type": RTS_CTS, DTR_DSR, RI, DCD, OUT1 or
  2421.                         'BothCmde' for RTS_CTS and DTR_DSR simultaneously.
  2422.                         "state"={'Inactif,' 'Local,' 'Eloigne,' 'Bilateral'}
  2423.                 Return: <Nothing>
  2424.  
  2425.         FUNCTION XonoffShaking_Status(VAR SendEnabled: BOOLEAN;
  2426.                   VAR Nb_Xoff: BYTE): BYTE;
  2427.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2428.                 Return: "SendEnabled"=TRUE if the transmit is authorized.
  2429.                         "Nb_Xoff": Number of Xoff received and no acknowledged.
  2430.                         "Xon" and "Xoff" are up-dated to the value used by
  2431.                         the driver for these codes.
  2432.                         'Inactif' (0): the Xon/Xoff protocol is not used.
  2433.                         otherwise: Xon/Xoff is used in the returned mode
  2434.                         in parameter ('Local', 'Eloigne', or 'Bilateral')
  2435.  
  2436.                                                                        38
  2437.  
  2438.  
  2439.  
  2440.         PROCEDURE XonoffShaking_setup(VAR state: BYTE);
  2441.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2442.                         "Xon" and "Xoff"= Defines the codes to use.
  2443.                         "state"={'Inactif', 'Local', 'Eloigne', 'Bilateral'}
  2444.                 Return: <Nothing>
  2445.  
  2446.         PROCEDURE Set_routine(VAR Uses: BOOLEAN; VAR Segment, Offsets: WORD);
  2447.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2448.                         Introduce the code of the routine to call in the
  2449.                         "PROCEDURE Routine;" declared right before
  2450.                         "Set_routine" in the COMINTRF.PAS file.
  2451.                         This code must not provoke any call to the DOS.
  2452.                 Return: Initialization done, the user routine will be called by
  2453.                         the driver when it works (i.e. for all communication
  2454.                         hard interrupt, transmit excluded).
  2455.                         "Uses": TRUE or FALSE depending on whether a routine
  2456.                         was already in place or not.
  2457.                         "Segment":"Offsets"= pointer to this possible routine !
  2458.  
  2459.         PROCEDURE Reset_routine(Segment, Offsets: WORD);
  2460.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2461.                         "Segment:Offsets": pointer to the routine to restore.
  2462.                 Return: The routine for the hardware interrupt is reactivated.
  2463.  
  2464.         PROCEDURE Unset_routine;
  2465.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2466.                 Return: The user routine is disactivated !
  2467.  
  2468.         PROCEDURE Set_err_routine(VAR Uses: BOOLEAN;VAR Segment,Offsets:WORD);
  2469.                 Call:   Introduce the code of the routine to call in the
  2470.                         "PROCEDURE Err_Routine;" declared right before
  2471.                         "Set_err_routine" in the COMINTRF.PAS file.
  2472.                         This code must not provoke any call to the DOS,
  2473.                         and it mustn't use any variable.
  2474.                 Return: Initialization done, the user routine will be called
  2475.                         by the driver in return of the interrupt 14h, if AH is
  2476.                         not reported null.
  2477.                         "Uses": TRUE or FALSE depending on whether a routine
  2478.                         was already in place or not.
  2479.                         "Segment":"Offsets"= pointer to this possible routine !
  2480.  
  2481.         PROCEDURE Reset_err_routine(Segment, Offsets: WORD);
  2482.                 Call:   "Segment:Offsets": pointer to the routine to restore.
  2483.                 Return: The designated routine for the int. 14h is reactivated.
  2484.  
  2485.         PROCEDURE Unset_err_routine;
  2486.                 Call:   <Nothing>
  2487.                 Return: The errors management routine is disactivated !
  2488.  
  2489.         PROCEDURE Locks;
  2490.                 Call:   <Nothing>
  2491.                 Return: <Nothing>
  2492.  
  2493.         PROCEDURE Deverrouille;
  2494.                 Call:   <Nothing>
  2495.                 Return: <Nothing>
  2496.  
  2497.                                                                        39
  2498.  
  2499.  
  2500.  
  2501.         FUNCTION GetPortName: BYTE;
  2502.                 Call:   <Nothing>
  2503.                 Return: Return 13 if STARCOMM.EXE is not available as a
  2504.                         DEVICE DRIVER;
  2505.                         otherwise, up-dates the "NomDevice" variable.
  2506.  
  2507.         FUNCTION GetPortDevice: BYTE;
  2508.                 Call:   <Nothing>
  2509.                 Return: Return 13 if STARCOMM.EXE is not available as a
  2510.                         DEVICE DRIVER; Return 0 to 7 (for COM1: to COM8:) to
  2511.                         designate the physical serial port in use.
  2512.  
  2513.         FUNCTION ResetPortDevice: BYTE;
  2514.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2515.                 Return: Return 0 if the commutation is made, 5 if the
  2516.                         given port is marked unknown by the driver (the
  2517.                         commutation is nonetheless achieved if the specified
  2518.                         port is between the COM1: and the COM8:...), or 13
  2519.                         if STARCOMM is not available in DEVICE DRIVER mode.
  2520.  
  2521.         FUNCTION EmulBIOS: BOOLEAN;
  2522.                 Call:   <Nothing>
  2523.                 Return: Return TRUE if the emulator is active, FALSE
  2524.                         otherwise.
  2525.  
  2526.         PROCEDURE SetEmulBIOS(status: BOOLEAN);
  2527.                 Call:   "status"=TRUE to activate the BIOS emulator,
  2528.                         FALSE to stop it.
  2529.                 Return: <Nothing>
  2530.  
  2531.         FUNCTION OrdiType: BYTE;
  2532.                 Call:   <Nothing>
  2533.                 Return: Return Type_PC, Type_XT, Type_AT, PS2_PC or PS2_AT.
  2534.  
  2535.         PROCEDURE SetOrdiType(status: BYTE);
  2536.                 Call:   "status"= Type_PC, Type_XT or Type_AT only.
  2537.                 Return: <Nothing>
  2538.  
  2539.                                                                        40
  2540.  
  2541.  
  2542.  
  2543.       4- Description of the procedures interfacing to the C:
  2544.       ──────────────────────────────────────────────────────
  2545.         Prototype:   byte <NAME> ([<ARGUMENT(S)>])
  2546.         ----------   Call:   - Global call variable
  2547.                              - Call parameters
  2548.                      Return: - global return variable
  2549.                              - Return parameters
  2550.                              - Functions return codes
  2551.  
  2552.         byte Check_STARCOMM_Present()
  2553.                 Call:   <Nothing>
  2554.                 Return: "RS_accessible" to TRUE if a driver is present.
  2555.                         0= no driver, 1= STARCOMM loaded in BIOS mode,
  2556.                         2= STARCOMM is loaded as a DEVICE DRIVER.
  2557.  
  2558.         byte Version(char *NumVer)
  2559.                 Call:   <Nothing>
  2560.                 Return: "*NumVer" contains the driver version in ASCII.
  2561.                         UN_CHECKED if presence of driver in RAM not checked,
  2562.                         TRUE in the other case.
  2563.  
  2564.         byte Open_Port()
  2565.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2566.                 Return: UN_CHECKED if presence of driver in RAM not checked;
  2567.                         0 if the port could be opened.
  2568.                         5 if the port is unknown.
  2569.                         8 if the driver was already active.
  2570.                         9 if the port doesn't dispose of any buffers.
  2571.  
  2572.         byte OpenPort_Buff(word Segment, word Offsets, word Taille_in,
  2573.                 word Taille_out)
  2574.                 Call:   idem preceding+ Seg:Ofs of the buffers and their sizes!
  2575.                 Return: idem preceding except 9= "overflowed segment !"
  2576.  
  2577.         byte Close_Port(byte ProtegeBuff)
  2578.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2579.                         "ProtegeBuff" to TRUE if the transmit buffer must be
  2580.                         emptiness before closing the port, to FALSE otherwise.
  2581.                 Return: UN_CHECKED if presence of driver in RAM not checked;
  2582.                         0 if the port could be closed.
  2583.                         5 if the port is unknown.
  2584.                         7 if it still remains some bytes to send (in this case,
  2585.                         the port is still opened), if "ProtegeBuff" to TRUE.
  2586.                         10 if unable to recover the associate buffer.
  2587.  
  2588.         byte Port_Opened()
  2589.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2590.                 Return: UN_CHECKED if presence of driver in RAM not checked;
  2591.                         TRUE if the port is opened, FALSE otherwise.
  2592.  
  2593.         byte Interdit_Port()
  2594.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2595.                 Return: UN_CHECKED if presence of driver in RAM not checked;
  2596.                         0 if the port could be correctly closed,
  2597.                         10 if the "CommPort" port buffers pair is lost.
  2598.                         The access of the port is forbidden in both cases.
  2599.  
  2600.                                                                        41
  2601.  
  2602.  
  2603.  
  2604.         byte Autorise_Port()
  2605.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2606.                 Return: UN_CHECKED if presence of driver in RAM not checked;
  2607.                         0 if the access of the port could be authorized,
  2608.                         5 if the port doesn't designate any usable UART (the
  2609.                         access to the port then remains forbidden).
  2610.  
  2611.         byte EtatVerrouilleComm(byte *Mode);
  2612.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2613.                 Return: UN_CHECKED if presence of driver in RAM not checked;
  2614.                         0 if the port could be accessed.
  2615.                         5 if the port is un-accessible.
  2616.                         "*Mode" worth 2 to 5 upon the locking status in use
  2617.                         (see next function for precise decoding of this...).
  2618.  
  2619.         byte VerrouilleComm(byte Mode);
  2620.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2621.                         "Mode" worth 2 to authorise any change, 3 to lock
  2622.                         the speed, 4 to lock the format or 5 to lock both.
  2623.                 Return: UN_CHECKED if presence of driver in RAM not checked;
  2624.                         0 if the port could be accessed, and the work is done.
  2625.                         5 if the port is un-accessible.
  2626.  
  2627.         byte SLOW_Ems()
  2628.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2629.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2630.                         Return 5 if the port is unknown.
  2631.  
  2632.         byte FAST_Ems()
  2633.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2634.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2635.                         Return 5 if the port is unknown.
  2636.  
  2637.         byte Send_SLOW()
  2638.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2639.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2640.                         Return TRUE if the designated port transmits slowly,
  2641.                         FALSE if it transmits in fast mode.
  2642.  
  2643.         void Get_Ports_Adresses()
  2644.                 Call:   <Nothing>
  2645.                 Return: "BasePort1" to "BasePort4" are up-dated.
  2646.  
  2647.         byte Infos_Uart(byte *Uart_type, unsigned int *Uart_adresse,
  2648.                 byte *Irq, byte *FIFO_actif, unsigned int *Taille_FIFO)
  2649.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2650.                 Return: UN_CHECKED if presence of driver in RAM not checked;
  2651.                         0 or 5: the parameters are informed
  2652.                         (5 if the port is considered as unknown).
  2653.  
  2654.                                                                        42
  2655.  
  2656.  
  2657.  
  2658.         byte Set_New_Uart(unsigned int Uart_adresse, byte Irq,
  2659.                 byte FIFO_actif, byte Taille_FIFO)
  2660.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2661.                         "Uart_adresse" <- value of the new address,
  2662.                         "Irq"          <- value 2,3,4,5,7,10,11,12 or 15.                          "FIFO_actif"<- 0= NO, 1= YES
  2663.                         "Taille_FIFO"  <- from 2 to 15 bytes
  2664.                 Return: UN_CHECKED if presence of driver in RAM not checked;
  2665.                         Otherwise, Error code of the function:
  2666.                         0 modifications are achieved,
  2667.                         5 if the port is unknown,
  2668.                         11 if the port is open (the port must be closed
  2669.                         to modify any of its physical parameters),
  2670.                         12 if the address reveals itself incorrect.
  2671.  
  2672.         byte Infos_Buffs(byte *Nb_utils, byte *Nb_maxi,
  2673.                 unsigned int *Taille_InBuff, unsigned int *Taille_OutBuff)
  2674.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2675.                 Return: UN_CHECKED if presence of driver in RAM not checked;
  2676.                         the parameters are informed otherwise.
  2677.  
  2678.         byte Init_Port(unsigned char length, unsigned char
  2679.                        stop_bit, unsigned char parity, long int speed,
  2680.                        unsigned int *Taille_InBuff,
  2681.                        unsigned int *Taille_OutBuff)
  2682.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2683.                         "length"   = '5,' '6,' '7,' or '8' bits,
  2684.                         "stop_bit" = '1' or '2,'
  2685.                         "parity"   = 'N','P','I','T' or 'R' for <N>o parity,
  2686.                         <P> even, <I> odd, <T> mark, or <R> rest,
  2687.                         "speed"={110,150,300,600,1200,2400,4800,9600,19200,
  2688.                                28800,38400,57600,115200} bits/second.
  2689.  
  2690.                 Return: "*Taille_InBuff"= Size of the receipt buffer(s).
  2691.                         "*Taille_OutBuff"= Size of the transmit buffer(s).
  2692.                         (These 2 numbers must give the number of bytes).
  2693.                         UN_CHECKED if presence of driver in RAM not checked,
  2694.                         1 if incorrect parameters (error= TRUE),
  2695.                         0 (FALSE) otherwise.
  2696.  
  2697.         byte Init_status()
  2698.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2699.                 Return: UN_CHECKED if presence of driver in RAM not checked;
  2700.                         TRUE otherwise, with "Format" up-dated.
  2701.  
  2702.         byte Reset_Init_status(unsigned int Format)
  2703.                 Call:   "CommPort" designates the concerned port (0 to 7);
  2704.                         "Format" specifies the reset value.
  2705.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2706.                         otherwise returns 1 for "incorrect parameter"
  2707.                         or 0 if the initialization could be achieved.
  2708.  
  2709.         byte flush_buffers()
  2710.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2711.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2712.                         TRUE in the other case.
  2713.  
  2714.         byte flush_InBuff()
  2715.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2716.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2717.                         TRUE in the other case.
  2718.  
  2719.                                                                        43
  2720.  
  2721.  
  2722.  
  2723.         byte flush_OutBuff()
  2724.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2725.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2726.                         TRUE in the other case.
  2727.  
  2728.         byte ResetCOM_and_TimMAX(byte RdTim_MAX, byte *Old_RdTim_MAX,
  2729.                          byte WrTim_MAX, byte *Old_WrTim_MAX)
  2730.                 Call:   "CommPort" designates the concerned port (0 to 7);
  2731.                         "RdTim_MAX" and "WrTim_MAX" must be included between
  2732.                         the ASCII values '0' and '9' in order to define a
  2733.                         maximum treatment expectation (in reading or writing)
  2734.                         included between ½ and 9 seconds. Passed the time limit
  2735.                         thus defined, the procedure of reading (or writing)
  2736.                         will abort on a "time-out" error. (The concerned
  2737.                         procedures are "ReadSerie" and "WriteSerie").
  2738.                 Return: "Old_RdTim_MAX" and "Old_WrTim_MAX" returns the values
  2739.                         used before the possible induced change by this call
  2740.                         to the procedure. Note that a value of 0 placed in
  2741.                         "RdTim_MAX" and/or "WrTim_MAX" to the call of the
  2742.                         PROCEDURE will make that there won't be modification
  2743.                         of the current values for the limits of time-out used
  2744.                         by the driver. The returned variables "Old_RdTim_MAX"
  2745.                         and "Old_WrTim_MAX" will be however correctly informed.
  2746.                         UN_CHECKED if presence of driver in RAM not checked,
  2747.                         TRUE in the other case.
  2748.  
  2749.         byte change_com_port(byte port)
  2750.                 Call:   "port"= N° of only port to keep opened
  2751.                         (0 to 7 for COM1: to COM8:).
  2752.                         "CommPort" is up-dated in return.
  2753.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2754.                         TRUE in the other case.
  2755.  
  2756.         byte Attend_Buff_ems_vide(byte Temps_maxi)
  2757.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2758.                         "Temps_maxi": 0 to 255 half seconds of expectation to
  2759.                         the pleased.
  2760.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2761.                         0 if the transmit buffer is emptiness,
  2762.                         4 if the maximum time limit of expectation is reached,
  2763.                         5 if the port is unknown.
  2764.  
  2765.         byte CheckBufferIn(unsigned int *Nb_a_lire)
  2766.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2767.                 Return: "*Nb_a_lire"= Nb. of byte(s) to read in receipt.
  2768.                         FALSE: the BuffIn is emptiness; TRUE otherwise.
  2769.                         UN_CHECKED presence of driver not checked.
  2770.  
  2771.         byte CheckBufferOut(unsigned int *Nb_libre)
  2772.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2773.                 Return: "*Nb_libre"= Nb. of free byte(s) in BuffOut.
  2774.                         TRUE: BuffOut has room; FALSE otherwise.
  2775.                         UN_CHECKED presence of driver not checked.
  2776.  
  2777.                                                                        44
  2778.  
  2779.  
  2780.  
  2781.         byte ReadSerie(unsigned char *car, unsigned int number,
  2782.                       unsigned int *Nb_received)
  2783.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2784.                         "*car"= first byte in order to arrange the
  2785.                         'string' to receive,
  2786.                         "number"= Nb. of byte(s) to read.
  2787.                 Return: "*Nb_received"= Nb. of byte(s) really read.
  2788.                         UN_CHECKED if presence of driver in RAM not checked,
  2789.                         0 if the reading of byte(s) appeared correct,
  2790.                         2 if the receipt is incorrect ("time-out").
  2791.  
  2792.         byte WriteSerie(unsigned char *car, unsigned int number,
  2793.                        unsigned int *Nb_written)
  2794.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2795.                         "*car"= first byte of the 'string' to send,
  2796.                         "number"= Nb. of byte(s) making the 'string'
  2797.                 Return: "*Nb_written"= Nb. of byte(s) effectively written.
  2798.                         UN_CHECKED if presence of driver in RAM not checked,
  2799.                         0 if the writing of byte(s) appeared correct,
  2800.                         3 if you asked to send no byte (!),
  2801.                         4 if a time-out occurred in writing.
  2802.                         5 if the port is unknown.
  2803.  
  2804.         byte ReadCarSerie(char *c)
  2805.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2806.                 Return: "*c"= byte received,
  2807.                         UN_CHECKED if presence of driver in RAM not checked,
  2808.                         0 if the reading of the byte appeared possible,
  2809.                         3 if no byte is available or if the port is closed,
  2810.                         5 if the port is unknown.
  2811.  
  2812.         byte WriteCarSerie(char c)
  2813.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2814.                         "c"= byte to send.
  2815.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2816.                         0 if the writing of the byte appeared possible,
  2817.                         3 if this byte couldn't be written (buffer full
  2818.                           or port closed),
  2819.                         5 if the port is unknown.
  2820.  
  2821.         byte Peek_rcp(char *c)
  2822.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2823.                 Return: "*c"= read byte,
  2824.                         UN_CHECKED if presence of driver in RAM not checked,
  2825.                         0 if the reading of the byte appeared possible,
  2826.                         3 if no byte is available or if the port is closed,
  2827.                         5 if the port is unknown.
  2828.  
  2829.         byte Poke_rcp(byte c);
  2830.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2831.                         "c"= byte to insert in the receipt buffer.
  2832.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2833.                         0 if the writing of the byte appeared possible,
  2834.                         3 if this byte couldn't be written (buffer full
  2835.                           or port closed),
  2836.                         5 if the port is unknown.
  2837.  
  2838.                                                                        45
  2839.  
  2840.  
  2841.  
  2842.         byte WriteCmde(byte *Cmde, byte nombre, byte UseDTR)
  2843.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2844.                         "*Cmde"= First byte of the control string to send,
  2845.                         "nombre"= Nb. of byte(s) making this command.
  2846.                         "UseDTR"= Set DTR in order to frame the orders
  2847.                         addressed to the device ?
  2848.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2849.                         0 if correct writing,
  2850.                         2 if no byte was given to send !
  2851.                         5 if the port is unknown.
  2852.  
  2853.         byte Status_Trait_Erreurs(byte *mode, byte *codeEr, byte *codeBk)
  2854.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2855.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2856.                         "mode"= substitution mode used. {"NonActif",
  2857.                         "Replaces", "RempNULL", "NoBreakBuff", "BreakOnBuff"}
  2858.                         "codeEr"= byte of replacement for the deficient bytes
  2859.                         to currently use.
  2860.                         "codeBk"= byte of replacement for the Break into buffer
  2861.  
  2862.         byte Def_Trait_Erreurs(byte mode, byte codes)
  2863.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2864.                         "mode"= substitution mode to activate. {"NonActif",
  2865.                         "Replaces", "RempNULL", "NoBreakBuff", "BreakOnBuff"}
  2866.                         "code"= byte of replacement for the deficient bytes.
  2867.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2868.                         return FALSE if the "mode" is acknowledged by the
  2869.                         driver, TRUE ("there is an error !") otherwise.
  2870.  
  2871.         byte etat_du_modem()
  2872.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2873.                 Return: "Voie_active": '1' for the COM1:, '2' for the COM2:,
  2874.                         '3' for the COM3:, '4' for the COM4:, etc...
  2875.                         Other variable: TRUE value (code 1) or FALSE (code 0)
  2876.                         ("Pret", "Clear_to_send", "Sonnerie", "Porteuse",
  2877.                         "dDSR", "dCTS", "dRI", "dDCD").
  2878.                         TRUE: change(s) of modem status since the last call;
  2879.                         FALSE otherwise; and UN_CHECKED if presence of driver
  2880.                         not checked.
  2881.  
  2882.         byte set_DTR()
  2883.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2884.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2885.                         TRUE otherwise (then DTR is switched to 1).
  2886.  
  2887.         byte clear_DTR()
  2888.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2889.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2890.                         TRUE otherwise (then DTR is switched to 0).
  2891.  
  2892.         byte set_RTS()
  2893.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2894.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2895.                         TRUE otherwise (then CTS is switched to 1).
  2896.  
  2897.         byte clear_RTS()
  2898.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2899.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2900.                         TRUE otherwise (then CTS is switched to 0).
  2901.  
  2902.                                                                        46
  2903.  
  2904.  
  2905.  
  2906.         byte set_OUT1()
  2907.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2908.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2909.                         TRUE otherwise (then OUT1 is switched to 1).
  2910.  
  2911.         byte clear_OUT1()
  2912.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2913.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2914.                         TRUE otherwise (then OUT1 is switched to 0).
  2915.  
  2916.         byte Send_brake()
  2917.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2918.                         "length" of the break interrupt signal: between 0
  2919.                         and 250 eighteenth of a second.
  2920.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2921.                         TRUE otherwise.
  2922.  
  2923.         byte Errors_Report()
  2924.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2925.                 Return: "Buff_overflow", "Engorgement", "Parite", "Stop_bit",
  2926.                         and "Break_it" are all up-dated.
  2927.                         TRUE: at least one error took place since the last call
  2928.                         to this function; FALSE: contrary case; and UN_CHECKED
  2929.                         if presence of driver in RAM not checked.
  2930.  
  2931.         byte Port_free()
  2932.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2933.                 Return: TRUE if we could reach to the COM:, FALSE otherwise.
  2934.                         UN_CHECKED if presence of driver in RAM not checked.
  2935.  
  2936.         byte HandShake_Status(byte Proto_type, byte *SendEnabled)
  2937.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2938.                         "Proto_type": RTS_CTS, DTR_DSR, RI, DCD or OUT1.
  2939.                 Return: "SendEnabled" returns TRUE if CTS or DSR=TRUE.
  2940.                         UN_CHECKED: presence in RAM of driver not checked.
  2941.                         If the protocol or signal is used, its mode is
  2942.                         returned: 'Local', 'Eloigne', or 'Bilateral'.
  2943.                         Otherwise 0 is returned ('Inactif').
  2944.  
  2945.         byte HandShake_Setup(byte Proto_type, byte state)
  2946.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2947.                         "Proto_type": RTS_CTS, DTR_DSR, RI, DCD, OUT1 or
  2948.                         'BothCmde' for RTS_CTS and DTR_DSR simultaneously.
  2949.                         "state" = mode to activate, 'Inactif' (= 0 or FALSE !)
  2950.                         in order to disactivate the harware hand-shaking
  2951.                         (mode: {'Local,' 'Eloigne,' 'Bilateral'})
  2952.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2953.                         TRUE in the other case.
  2954.  
  2955.         byte XonoffShaking_Status(byte *SendEnabled, byte *Nb_Xoff)
  2956.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2957.                 Return: "SendEnabled" returns TRUE if CTS=TRUE.
  2958.                         "Nb_Xoff":Number of Xoff received and not acknowledged.
  2959.                         "Xon" and "Xoff" are up-dated to the value used by the
  2960.                         driver for these codes.
  2961.                         UN_CHECKED if presence of driver in RAM not checked,
  2962.                         otherwise: if Xon/Xoff is used, the utilization mode is
  2963.                         returned ('Local,' 'Eloigne,' 'Bilateral'); if it is
  2964.                         not used: 'Inactif' (= 0 or FALSE!) is returned.
  2965.  
  2966.                                                                        47
  2967.  
  2968.  
  2969.  
  2970.         byte XonoffShaking_Setup(byte state)
  2971.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2972.                         "Xon" and "Xoff"= Defines the codes to use.
  2973.                         "state"={'Inactif', 'Local', 'Eloigne', 'Bilateral'}
  2974.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2975.                         TRUE: initialization done.
  2976.  
  2977.         byte Set_routine(unsigned Segprog int, unsigned Ofsprog int,
  2978.                          unsigned int *OldSeg, unsigned int *OldOfs)
  2979.                 Call:   "CommPort" designates the concerned port (0 to 7),
  2980.                         "Segprog"= Segment of the "FAR" user routine,
  2981.                         "Ofsprog"= Offsets of this user routine.
  2982.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2983.                         TRUE or FALSE whether an old routine was already
  2984.                         activated or not before the new one.
  2985.                         "* OldSeg"= Segment of the old routine,
  2986.                         "* OldOfs"= Offsets of the old routine.
  2987.  
  2988.         byte Unset_routine()
  2989.                 Call:   "CommPort" designates the concerned port (0 to 7).
  2990.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  2991.                         TRUE: disactivated routine.
  2992.  
  2993.         byte Set_err_routine(unsigned Segprog int, unsigned Ofsprog int
  2994.                         unsigned int *OldSeg,  unsigned int *OldOfs)
  2995.                 Call:   "Segprog"= Segment of the "FAR" user routine,
  2996.                         "Ofsprog"= Offsets of this user routine.
  2997.                         The code of the routine must not provoke any call to
  2998.                         the DOS, and it must not use any variable !
  2999.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  3000.                         TRUE or FALSE depending on the existance of a routine
  3001.                         already there before !
  3002.                         "*OldSeg"= Segment of the old routine,
  3003.                         "*OldOfs"= Offsets of the old routine.
  3004.  
  3005.         byte Unset_err_routine()
  3006.                 Call:   <Nothing>
  3007.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  3008.                         TRUE: Routine is disactivated.
  3009.  
  3010.         byte Locks()
  3011.                 Call:   <Nothing>
  3012.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  3013.                         TRUE: Driver locking is done.
  3014.  
  3015.         byte Deverrouille()
  3016.                 Call:   <Nothing>
  3017.                 Return: UN_CHECKED if presence of driver in RAM not checked,
  3018.                         TRUE: Driver unlocking is done.
  3019.  
  3020.         byte GetPortName()
  3021.                 Call:   <Nothing>
  3022.                 Return: UN_CHECKED if presence of driver in RAM not checked;
  3023.                         Returns 13 if STARCOMM.EXE is not available as a
  3024.                         DEVICE DRIVER. Otherwise, up-dates "NomDevice".
  3025.  
  3026.         byte GetPortDevice()
  3027.                 Call:   <Nothing>
  3028.                 Return: UN_CHECKED if presence of driver in RAM not checked;
  3029.                         Returns 13 if STARCOMM.EXE is not available as a DEVICE
  3030.                         DRIVER; otherwise, returns 0 to 7 for COM1: to COM8:
  3031.  
  3032.                                                                        48
  3033.  
  3034.  
  3035.  
  3036.         byte ResetPortDevice()
  3037.                 Call:   "CommPort" designates the concerned port (0 to 7).
  3038.                 Return: UN_CHECKED if presence of driver in RAM not checked;
  3039.                         otherwise, returns 0 if the commutation is made,
  3040.                         5 if the given port is marked unknown by the driver
  3041.                         (the commutation is nonetheless achieved if the
  3042.                         specified port is between the COM1: and the COM8:...),
  3043.                         or 13 if STARCOMM is not available in DEVICE DRV mode.
  3044.  
  3045.         byte EmulBIOS()
  3046.                 Call:   <Nothing>
  3047.                 Return: UN_CHECKED if presence of driver in RAM not checked;
  3048.                         Returns TRUE if the emulator is active,FALSE otherwise.
  3049.  
  3050.         byte SetEmulBIOS(byte status)
  3051.                 Call:   "status"=TRUE to activate the emulator,FALSE to stop it
  3052.                 Return: <Nothing>
  3053.  
  3054.         byte OrdiType()
  3055.                 Call:   <Nothing>
  3056.                 Return: UN_CHECKED if presence of driver in RAM not checked;
  3057.                         Returns Type_PC, Type_XT, Type_AT, PS2_PC or PS2_AT.
  3058.  
  3059.         byte SetOrdiType(byte status)
  3060.                 Call:   "status"= Type_PC, Type_XT or Type_AT only.
  3061.                 Return: <Nothing>
  3062.  
  3063.                                                                        49
  3064.  
  3065.  
  3066.  
  3067.  
  3068.  
  3069.       5- STARCOMM.EXE errors codes:
  3070.       ─────────────────────────────
  3071.         If AH<>0 the Carry-Flag is set (CF=1), otherwise it is null (CF= 0).
  3072.         (All following errors codes are given in decimal...)
  3073.  
  3074.         0--> No error. Requested work is done.
  3075.         1--> Number of an under-function OR working mode is unknown !
  3076.              No treatment has been done...
  3077.         2--> The reading routine was interrupted upon reception of a break
  3078.              interrupt signal.
  3079.         3--> No byte has been read or written, due to lack of room (in
  3080.              writing) or due to absence of any byte to read; OR the port
  3081.              designated by the control is closed, what forbade any transac-
  3082.              -tion with it !
  3083.         4--> Time-out error in reading (the receipt buffer remains empty
  3084.              before the routine has read the Nb. of wanted bytes), or in wri-
  3085.              -ting (the transmit buffer remains full or is emptied too slowly).
  3086.         5--> The serial port indicated is physically or logically unknown.
  3087.         6--> Requested speed initialization is not valid.
  3088.         7--> Transmit buffer not emptiness: thus, the port was not closed !
  3089.         8--> Serial port already active: Only one opening for each port !
  3090.         9--> Unable to open the port: no more available buffer is available
  3091.              OR (if opening the port with definition of external buffers)
  3092.              buffers no located in a same segment (or overflows of the data
  3093.              segment), OR one of the 2 specified buffers has a size less
  3094.              than 256 bytes (minimal admitted size for each buffer !).
  3095.        10--> Unable to recover the buffer allocated to the port to close !
  3096.              (This error normally couldn't ever occur...).
  3097.              This would have for consequence to lose one buffers pair !...
  3098.        11--> Port is open: Any change of hardware parameters is FORBIDDEN !
  3099.        12--> New address specified for the port not adapted.
  3100.        13--> STARCOMM.EXE is not available in its DEVICE DRIVER mode !
  3101.  
  3102.         Notice that NO error is specified to a program asking for a new port
  3103.       initialization to use, port whose speed and/or format is/are locked:
  3104.       this permits to make the calling program think that its requesting is
  3105.       well achieved in order to make it work perfectly, even thought it can't
  3106.       modify part (or all) the serial port(s) inits !
  3107.  
  3108.                                                                        50
  3109.  
  3110.  
  3111.  
  3112.  
  3113.  
  3114.   II- INTERFACING, for the PROGRAMMERS, from the DOS INT 21h:
  3115.   ═══════════════════════════════════════════════════════════
  3116.       This software interface to the STARCOMM driver is not accessible
  3117.    except when STARCOMM.EXE is loaded in memory as a DEVICE DRIVER.
  3118.    It is necessary to note that the functions here-by added (see their
  3119.    descriptions below) add themselves to the basics functions of the
  3120.    interrupt 14H, interrupt that will still be available in this case...
  3121.  
  3122.  
  3123.  
  3124.       1- direct Access to the driver:
  3125.       ───────────────────────────────
  3126.         Function 3Dh: Open the access to the logical file "COMM:" that brings
  3127.                 STARCOMM.EXE when loaded as a DEVICE DRIVER. The physical
  3128.                 serial port associated to the "COMM:" unit is opened after
  3129.                 this function.
  3130.  
  3131.                 Call:        AH = 3Dh
  3132.                              AL = <Code of type of aperture>
  3133.                                        0: open in reading,
  3134.                                        1: open in writing,
  3135.                                        2: open in reading + writing.
  3136.                              DS:DX = Pointer to the DEVICE NAME, i.e. to "COMM"
  3137.                                 that is the logical name of STARCOMM.EXE. This
  3138.                                 string must be of ASCII-Z type, that is to say
  3139.                                 it must finishes with the hexa. code 0...
  3140.                 Return:      AX = HANDLER to access the device (if no error).
  3141.                              AL = <Error code> otherwise (+CFlag set).
  3142.  
  3143.         Function 3Eh: Close the access to the device driver and provokes the
  3144.                 transmit of an EOF code (=1Ah) if at least one byte was
  3145.                 already sent to the means of the serial device driver.
  3146.                 Remark: It is the transmission of this EOF code to the closing
  3147.                 of the driver that allows to use "COMM:" as a full device from
  3148.                 within the DOS prompt...
  3149.                 ATTENTION: This function doesn't close the physical port
  3150.                 associated to "COMM:" because it is possible that the transmit
  3151.                 buffer is not entirely transmitted right as it is called !
  3152.  
  3153.                 Call:        AH = 3Eh
  3154.                              BX = HANDLER
  3155.                 Return:      AX = HANDLER to access the device (if no error).
  3156.                              AL = <Error code> otherwise (+CFlag set).
  3157.  
  3158.                                                                        51
  3159.  
  3160.  
  3161.  
  3162.  
  3163.  
  3164.         Function 3Fh: Read data from the receipt buffer.
  3165.                 If you ask to read more data than available in the buffer,
  3166.                 this function waits for other data to be received before
  3167.                 returning to the calling process. (Loop reading until
  3168.                 completion of the request, or receipt of a break interrupt, or
  3169.                 occurrence of a time-out error...).
  3170.                 Note that on receipt of an EOF code, this DOS services routine
  3171.                 considers that the calling application must react to this code.
  3172.                 Until there has been closing then opening of the access to
  3173.                 the device driver (functions 3Dh and 3Eh), the function 3Fh
  3174.                 considers that the application didn't react to the EOF.
  3175.                 From then on, it will only transmit this EOF code and won't
  3176.                 return any other byte from the receipt buffer ! To this topic,
  3177.                 read the second remark (referred as "ATTENTION:") in the
  3178.                 following lines.
  3179.  
  3180.                 Call:        AH = 3Fh
  3181.                              BX = HANDLER
  3182.                              CX = Number of expected bytes.
  3183.                              DS:DX = Seg:Off of first byte of the string
  3184.                                      in which to store the expected bytes.
  3185.                               !! ATTENTION: Assure to reserve a sufficient
  3186.                               !! space for the incoming bytes.
  3187.                               !! ATTENTION: The DOS interprets all ^Z code
  3188.                               !! (hexa. code 1Ah) as an EOF specifier. It
  3189.                               !! won't be possible to read any more data
  3190.                               !! received from the driver after reception of
  3191.                               !! such a code. 3 solutions:
  3192.                               !!   1°/ Use ASCII transcription (Cf CODAGES.DOC)
  3193.                               !! in order to transmit some binary files.
  3194.                               !!   2°/ After any ^Z reception, call the
  3195.                               !! functions 3Eh (Close) and 3Dh (Open) to
  3196.                               !! reset the process (Cf. TERMINAL.C example.).
  3197.                               !!   3°/ Disactivate the DOS hand-shaking using
  3198.                               !! its function 44h (IOCTL).
  3199.                               !! Following the assembler code of it:
  3200.                               !!  - mov ah,44h ;Get Device data
  3201.                               !!  - mov al,0
  3202.                               !!  - mov bx,<Dev_handle>
  3203.                               !!  - int 21h
  3204.                               !!  -...
  3205.                               !!  -<Treat the errors if CarryFlag_ON...>
  3206.                               !!  -...
  3207.                               !!  - mov ah,44h ;Set Device data OFF
  3208.                               !!  - mov al,1
  3209.                               !!  - mov bx,<Dev_handle>
  3210.                               !!  - mov dx,0020h
  3211.                               !!  - int 21h
  3212.                               !! Ctrl-P, Ctrl-S and Ctrl-Z will then be
  3213.                               !! un-meaningful to the eyes of DOS.
  3214.                 Return:       CFlag to 1:
  3215.                                  AX = 0Bh. "Error in reading".
  3216.                               CFlag to 0:
  3217.                                  AX = Number of bytes truly received.
  3218.  
  3219.                                                                        52
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.         Function 40h: Write data to send in the transmit buffer.
  3226.                 If you try to write more data than the room remaining in the
  3227.                 transmit buffer, this function waits to be able to finish its
  3228.                 action before returning to the calling process.
  3229.                 (Writing loop until completion or time-out).
  3230.  
  3231.                 Call:        AH = 40h
  3232.                              BX = HANDLER
  3233.                              CX = Number of bytes to send.
  3234.                              DS:DX = Seg:Off of first byte of the string of
  3235.                                      bytes to send.
  3236.                 Return:       CFlag to 1:
  3237.                                  AX = 0AH.  "Error in writing".
  3238.                               CFlag to 0:
  3239.                                  AX = Number of bytes effectively written.
  3240.  
  3241.         Function 44h: Is the receipt buffer empty ?
  3242.  
  3243.                 Call:        AH = 44h
  3244.                              AL = 06h (code of under-function)
  3245.                              BX = HANDLER
  3246.                 Return:      AL = 0 for No, 1 for YES
  3247.  
  3248.         Function 44h: Is the transmit buffer full ?
  3249.  
  3250.                 Call:        AH = 44h
  3251.                              AL = 07h (code of under-function)
  3252.                              BX = HANDLER
  3253.                 Return:      AL = 0 for No, 1 for YES
  3254.  
  3255.         Function 44h: IOCTL-READ Demand to the "COMM:" file which port it is
  3256.                 interfacing, the communication format in use, and the
  3257.                 hand-shaking mode(s) used for this port (if any).
  3258.  
  3259.                 Call:        AH = 44h
  3260.                              AL = 02h (Code of reading under-function)
  3261.                              BX = HANDLER
  3262.                              DS:DX = Pointer to the 11 consecutives bytes in
  3263.                                 RAM, reserved in order to receive the requested
  3264.                                 informations.
  3265.                                 !! ATTENTION: Reserve a sufficient space
  3266.                                 !! to receive the 11 bytes !
  3267.                              CX = Number of bytes making the string pointed
  3268.                                 by DS:DX (11 inevitably !).
  3269.  
  3270.                                                                        53
  3271.  
  3272.  
  3273.  
  3274.  
  3275.  
  3276.                 Return:      AX = DOS error code if CFlag is active.
  3277.                                 In case of no error, the 11 bytes pointed by
  3278.                                 DS:DX to the call has the following
  3279.                                 meaning:
  3280.                                 byte 1: Serial port interfaced by "COMM:":
  3281.                                         0 (COM1:) to 7 (for the COM8:).
  3282.                                 byte 2,3: Speed, Format of communication.
  3283.                                 byte 4,5: Activity of RTS/CTS, DTR/DSR.
  3284.                                 byte 6 to 8: Activity of RI, DCD and OUT1.
  3285.                                 byte 9: Activity of Xon/Xoff.
  3286.                                 byte 10: Code used for Xon.
  3287.                                 byte 11: Code used for Xoff.
  3288.                                 In order to interpret the composition of the
  3289.                                 bytes 2 and 3, report the function 9 of the
  3290.                                 interrupt 14h (BH register for the speed, and
  3291.                                 BL for the format...).
  3292.  
  3293.         Function 44h: IOCTL-WRITE Indicates the driver the serial port that it
  3294.                 interfaces, the communication format to use, and the hand-
  3295.                 shaking mode to activate (if any). The modifications of format
  3296.                 and hand-shaking are only acknowledged if the specified port
  3297.                 is the one in use by the "COMM:" device driver; otherwise,there
  3298.                 is only modification of the serial port number used by "COMM":,
  3299.                 without NO other initialization (this permits to establish a
  3300.                 multi-communication flow by using the "COMM:" file !...).
  3301.  
  3302.                 Call:        AH = 44h
  3303.                              AL = 03h (Code of writing under-function)
  3304.                              BX = HANDLER
  3305.                              DS:DX = Pointer to the 11 consecutives bytes in
  3306.                                 RAM, reserved in order to transmit the news
  3307.                                 initializations to be used.
  3308.                                 The informations to store in these 11
  3309.                                 bytes are identical to those developed in the
  3310.                                 'Return' paragraph of the previous function.
  3311.                              CX = Number of bytes making the string pointed
  3312.                                 by DS:DX (8 inevitably !).
  3313.                 Return:      AX = Code of DOS error if CFlag is active.
  3314.  
  3315.                                                                        54
  3316.  
  3317.  
  3318.  
  3319.  
  3320.  
  3321.       2- Procedures of interfacing for TURBO-PASCAL and TURBO-C:
  3322.       ──────────────────────────────────────────────────────────
  3323.       The supplementary previous functions (own to STARCOMM.EXE used as a
  3324.     DEVICE DRIVER) are also interfaced for the PASCAL and the C. This
  3325.     paragraph gives the variables and supplementary specifics functions,
  3326.     that also are in the STARINTF.PAS files and STARINTF.C.
  3327.  
  3328.      ────────────────────-
  3329.        Global variables:
  3330.      ─────────────────────
  3331.      NomDevice: Identification string of the device driver. It is the logical
  3332.         name associated to STARCOMM when it is installed in memory as a
  3333.         DEVICE DRIVER. This name is: "COMM:".
  3334.      handler_voie_serie:
  3335.         Key to access the DEVICE DRIVER. It is created at the opening of the
  3336.         DEVICE, and destroyed at its closing.
  3337.      COMM_ouvert: Status flag of the serial port activity (i.e. open or close).
  3338.         It is a boolean variable !
  3339.  
  3340.      ───────────────────────────────────
  3341.        Available procedures/functions:
  3342.      ──────────────────────────────────-
  3343.      Open_COMM:
  3344.        Provokes the opening of the logical file "COMM":.
  3345.        The handler to access the device is needed at the calling time to
  3346.        this function.
  3347.      Close_COMM:
  3348.        Provokes the closing of the logical file opened by Open_COMM.
  3349.      IOStream_READ:
  3350.        Permits to request to the installed driver the communication format
  3351.        (speed and structure) it is using, and its used hand-shaking...
  3352.        Contrarily to the similar available functions available from the
  3353.        BIOS 14h interrupt, this function uses the DOS IOCTL channel in order
  3354.        to inform you on the requested comm. specifications in use for the
  3355.        serial port represented by the logical port called "COMM:"...
  3356.      IOStream_WRITE:
  3357.        This is the complementary of the previous function: "IOStrteam_WRITE"
  3358.        permits to order the driver to use the new specified values (format
  3359.        and hand-shaking) OR to make the "COMM:" logical port to access a
  3360.        new physical serial port:
  3361.        - if the indicated serial port is different from the one in use,
  3362.        "COMM:" will represent this new port, and NO initialization nor hand-
  3363.        shaking working mode change is made;
  3364.        - otherwise the specified initializations are achieved.
  3365.      CheckCOMMIn:
  3366.        Is there any byte to read from the receipt buffer ?
  3367.      CheckCOMMOut:
  3368.        Is there any room in the transmit buffer ?
  3369.      ReadCOMM:
  3370.        Read N byte(s) from the receipt buffer.
  3371.      WriteCOMM:
  3372.        Send N byte(s) to the serial port via the transmit buffer.
  3373.  
  3374.                                                                        55
  3375.  
  3376.  
  3377.  
  3378.  
  3379.  
  3380.       3- Description of the procedures interfacing to the PASCAL:
  3381.       ──────────────────────────────────────────────────────────-
  3382.         Prototype:   PROCEDURE|FUNCTION <name>[(<ARGUMENT(S)>)][:<type>];
  3383.         ----------   Call:   - Global call variables
  3384.                              - Call parameters
  3385.                      Return: - Global return variables
  3386.                              - Return parameters
  3387.                              - Functions return codes
  3388.  
  3389.         FUNCTION Open_COMM: WORD;
  3390.                 Call:   "NomDevice" contains the name of the DOS device
  3391.                         driver. Initialized to "COMM" by default.
  3392.                         Don't have to be modified !
  3393.                 Return: "port_ouvert" indicates the logical port status,
  3394.                         i.e. if it is open (TRUE) or close (FALSE).
  3395.                         0 in case of an opening success.
  3396.                         <DosCodeErr> for the other possible DOS errors.
  3397.  
  3398.         FUNCTION Close_COMM: INTEGER;
  3399.                 Call:   "NomDevice" contains the name of the DOS device
  3400.                         driver. Initialized to "COMM" by default.
  3401.                         Don't have to be modified !
  3402.                 Return: "port_ouvert" indicates the logical port status,
  3403.                         i.e. if it is open (TRUE) or close (FALSE).
  3404.                         -1 if the driver presence in RAM had not been
  3405.                         checked before the call (by a "Open_COMM" call !).
  3406.                         0 in case of a closing success.
  3407.                         <DosCodeErr> for the other possible DOS errors.
  3408.  
  3409.         FUNCTION IOStream_READ(VAR Voie_active: CHAR; VAR Format: WORD;
  3410.                   VAR RTS_type, DTR_type, RI_type, DCD_type, OUT1_type,
  3411.                   Xonoff_type: CHAR): BOOLEAN;
  3412.                 Call:   <Nothing>
  3413.                 Return: TRUE in case of an error, FALSE otherwise.
  3414.                         In the absence of errors, the global variable "Xon"
  3415.                         and "Xoff" are informed. The parameters provided
  3416.                         in arguments are up-dated:
  3417.                         "Voie_active" --> '1' to '8' for COM1: to COM8:,
  3418.                         "Format"      --> high byte = speed,
  3419.                                           low byte  = structure.
  3420.                         (See the interrupt 14h, function 9 for the values/
  3421.                         meaning correspondences...).
  3422.                         "RTS_type"    --> 0, 'B,' 'E' or 'L' in order to define
  3423.                         the active mode (Local, Distant, or Bilateral...).
  3424.  
  3425.                                                                        56
  3426.  
  3427.  
  3428.  
  3429.  
  3430.  
  3431.         FUNCTION IOStream_WRITE(VAR Voie_active: CHAR; VAR Format: WORD;
  3432.                   VAR RTS_type, DTR_type, RI_type, DCD_type, OUT1_type,
  3433.                   Xonoff_type: CHAR): BOOLEAN;
  3434.                 Call:   The global variables "Xon" and "Xoff" must be informed.
  3435.                         The arguments parameters are to be fill as indicated
  3436.                         below:
  3437.                         "Voie_active" --> '1' to '8' for COM1: to COM8:,
  3438.                         "Format"      --> high byte = speed,
  3439.                                           low byte  = structure.
  3440.                         (See the interrupt 14h, function 9 for the values/
  3441.                         meaning correspondances...).
  3442.                         "RTS_type"    --> 0, 'B,' 'E' or 'L' in order to define
  3443.                         the active mode (Local, Distant, or Bilateral...).
  3444.                 Return: TRUE in case of error, FALSE otherwise.
  3445.  
  3446.         FUNCTION CheckCOMMIn: BOOLEAN;
  3447.                 Call:   <Nothing>
  3448.                 Return: FALSE: the input buffer is emptiness or the port is
  3449.                         closed, TRUE otherwise.
  3450.  
  3451.         FUNCTION CheckCOMMOut: BOOLEAN;
  3452.                 Call:   <Nothing>
  3453.                 Return: TRUE if the output buffer has room; FALSE otherwise.
  3454.  
  3455.         FUNCTION ReadCOMM(VAR c: CHAR; nombre: WORD): INTEGER;
  3456.                 Call:   "c"= First byte in order to store the 'string' to
  3457.                         receive, "nombre"= Nb. of byte(s) to read.
  3458.                 Return: 0 if the reading of byte(s) appeared correct
  3459.                         <DosCodeErr> if incorrect receipt (Time-out...)
  3460.                         -1 if no byte could be read.
  3461.  
  3462.         FUNCTION WriteCOMM(VAR c: CHAR; nombre: WORD): INTEGER;
  3463.                 Call:   "c"= First byte of the 'string' to send,
  3464.                         "nombre"= Nb. of byte(s) making the 'string'.
  3465.                 Return: 0 if the writing of byte(s) appeared correct,
  3466.                         <DosCodeErr> if incorrect receipt (Time-out...)
  3467.                         - 1 if no byte could be written.
  3468.  
  3469.                                                                        57
  3470.  
  3471.  
  3472.  
  3473.  
  3474.  
  3475.       4- Description of the procedures interfacing to the C:
  3476.       ──────────────────────────────────────────────────────
  3477.         Prototype:   byte <NAME> ([<ARGUMENT(S)>])
  3478.         ----------   Call:   - Global call variables
  3479.                              - Call parameters
  3480.                      Return: - Global return variables
  3481.                              - Return parameters
  3482.                              - Functions return code
  3483.  
  3484.         int Open_COMM()
  3485.                 Call:   "NomDevice" contains the name of the DOS device
  3486.                         driver. Initialized to "COMM" by default.
  3487.                         Don't have to be modified !
  3488.                 Return: "port_ouvert"=TRUE if successful opening.
  3489.                         0 in case of opening success.
  3490.                         8 if the driver was already active.
  3491.                         <DosCodeErr> for the other DOS possible errors.
  3492.  
  3493.         int Close_COMM()
  3494.                 Call:   "NomDevice" contains the name of the DOS device
  3495.                         driver. Initialized to "COMM" by default.
  3496.                         Don't have to be modified !
  3497.                 Return: "port_ouvert"=FALSE if successful closing.
  3498.                         UN_OPENED if presence of driver in RAM not true.
  3499.                         0 in case of closing success.
  3500.                         7 indicates that it still remains bytes to send
  3501.                         out: the port hadn't been close !
  3502.                         <DosCodeErr> for the other DOS possible errors.
  3503.  
  3504.         byte IOStream_READ(byte *RTS_type, byte *DTR_type, byte *RI_type,
  3505.                         byte *DCD_type, byte *OUT1_type, byte *Xonoff_type)
  3506.                 Call:   <Nothing>
  3507.                 Return: UN_OPENED if presence of driver in RAM not true,
  3508.                         1 (TRUE) if any error, 0 (FALSE) otherwise.
  3509.                         In the absence of any error, the globals variables
  3510.                         "Xon" and "Xoff", "Voie_active" and "Format" are
  3511.                         informed. The arguments "*RTS_type", etc. are up-dated.
  3512.                         "Voie_active" --> '1' to '8' for COM1: to COM8:,
  3513.                         "Format"      --> high byte = speed,
  3514.                                           low byte  = structure.
  3515.                         (See the interrupt 14h, function 9 for the values/
  3516.                         meaning correspondances...).
  3517.                         "RTS_type" --> 0, 'B,' 'E' or 'L' in order to define
  3518.                         the active mode (Local, Distant, or Bilateral...).
  3519.  
  3520.                                                                        58
  3521.  
  3522.  
  3523.  
  3524.  
  3525.  
  3526.         byte IOStream_WRITE(RTS_type byte, DTR_type byte, RI_type byte,
  3527.              DCD_type byte, byte OUT1_type, Xonoff_type byte)
  3528.                 Call:   The globals variables "Xon" and "Xoff", "Voie_active"
  3529.                         and "Format" must be informed, in addition to the
  3530.                         function explicit arguments.
  3531.                         "Voie_active" --> '1' to '8' for COM1: to COM8:,
  3532.                         "Format"      --> high byte = speed,
  3533.                                           low byte  = structure.
  3534.                         (See the interrupt 14h, function 9 for the values/
  3535.                         meaning correspondances...).
  3536.                         "RTS_type" --> 0, 'B,' 'E' or 'L' in order to define
  3537.                         the active mode (Local, Distant, or Bilateral...).
  3538.                 Return: UN_OPENED if presence of driver in RAM no true,
  3539.                         1 (TRUE) if a error is brought back,
  3540.                         0 (FALSE) otherwise.
  3541.  
  3542.         byte CheckCOMMIn()
  3543.                 Call:   <Nothing>
  3544.                 Return: FALSE: the input buffer is emptiness; TRUE otherwise.
  3545.                         UN_OPENED: port not opened.
  3546.  
  3547.         byte CheckCOMMOut()
  3548.                 Call:   <Nothing>
  3549.                 Return: TRUE: the output buffer has room; FALSE otherwise.
  3550.                         UN_OPENED: port not opened.
  3551.  
  3552.         int ReadCOMM(byte *car, unsigned int number)
  3553.                 Call:   "*car" = first byte in order to store the 'string'
  3554.                         to receive, "number"= Nb. of byte(s) to read.
  3555.                 Return: UN_OPENED: the port was not opened before,
  3556.                         0 if correct reading,
  3557.                         <DosCodeErr> if an error is produced,
  3558.                         -1 if no byte could be read.
  3559.  
  3560.         int WriteCOMM(byte *car, unsigned int number)
  3561.                 Call:  "*car"= first byte of the 'string' to send,
  3562.                         "number"= Nb. of byte(s) making the 'string'.
  3563.                 Return: UN_OPENED: the port was not opened before,
  3564.                         0 if correct writing,
  3565.                         <DosCodeErr> if an error is produced,
  3566.                         -1 if no byte could be written.
  3567.  
  3568.                                                                        59
  3569.  
  3570.  
  3571.  
  3572.  
  3573.  
  3574.       5- DOS errors codes:
  3575.       ────────────────────
  3576.       From the interrupt 21h, the errors codes returned are the usual codes
  3577.     returned from the DOS. Here are the mains DOS errors codes in connection
  3578.     with the accesses to the "character" device drivers type:
  3579.  
  3580.                     0--> No error. The requested work is achieved.
  3581.                     1--> Function number is unknown !
  3582.                     2--> Unknown file (verify that the DEVICE name
  3583.                          is still "COMM:"...).
  3584.                     4--> Too many open files.
  3585.                     5--> Access denied (protection in reading or writing).
  3586.                     6--> HANDLER not valid.
  3587.                     8--> Memory not sufficient in order to create a
  3588.                          new "handler".
  3589.                    29--> Error in writing.
  3590.                    30--> Error in reading.
  3591.                    31--> Internal error to the system.
  3592.  
  3593.                                                                        60
  3594.  
  3595.   III- INTERFACING, for the PROGRAMMERS, to SCLIB.OBJ:
  3596.   ════════════════════════════════════════════════════
  3597.       The BIOS mode of STARCOMM.EXE may be integrated to any application
  3598.     made in a language that generates files to the ".OBJ" format before
  3599.     its link phase. It is sufficient, when such is the case, to bind the
  3600.     application "*.OBJ" file(s) with SCLIB.OBJ (from SERIAL PORTS MANAGER).
  3601.       This library will then permit to install the usual interfacing
  3602.     of STARCOMM.EXE on the interrupt 14h, to uninstall it, and will even
  3603.     permit to call the classics services from this interrupt without having
  3604.     to generate any classical "INT 14h" call !
  3605.  
  3606.       The 3 globals following functions (THAT DO NOT USE ANY STACKED PARAMETER
  3607.     AT THEIR CALL) permits this operation; Note that the first 2 don't assure
  3608.     the preservation of the CPU registers to the return:
  3609.         Set_SCL  --> Installs and activates the driver integrated to SCLIB.
  3610.                      Use the initialization addresses, IRQ, and parameters
  3611.                      defined by default in the library (use the functions 09h,
  3612.                      0Ah and 2Eh in order to adapt the hardware parameters...).
  3613.                      There will always be 2 buffers of ½ Ko created for each
  3614.                      logical port recognized (8 in all) without any possibility
  3615.                      to make any other choice concerning the internals buffers
  3616.                      sizes (Cf. function 07h with AL=6 in order to use your own
  3617.                      buffers,so called "external" relatively to the library !)
  3618.                      Call:   <Nothing>
  3619.                      Return: CARRY SET if "Set_SCL" was already called at least
  3620.                              once before the present call: NO ACTION has THERE-
  3621.                              FORE BEEN MADE ! No risk of embedded installations
  3622.                              in case of thoughtlessly repeated calls.
  3623.         UnSetSCL --> Disactivates the driver integrated to SCLIB.
  3624.                      The opened ports are closed and the used interrupts are
  3625.                      freed. The used UART is initialized as found at the time
  3626.                      of the first call to "Set_SCL".
  3627.                      Call:   <Nothing>
  3628.                      Return: CARRY SET if "Set_SCL" was not called at least
  3629.                              once before "UnSetSCL" !
  3630.                              No risk of destructive uninstallations in case
  3631.                              of multiple calls.
  3632.         SCLservs --> Permits the direct call to the services functions, without
  3633.                      generating the software interrupt 14h.
  3634.                      This could be interesting for the programs working under
  3635.                      some "MULTI-TASKER" that do not share the INT 14h without
  3636.                      modifying some CPU registers to the transition !!!
  3637.                      Call:   Load the registers as needed in order to call
  3638.                              the requested function, like you would for an
  3639.                              interrupt 14 call (report to the paragraph I of
  3640.                              the present document).
  3641.                      Return: CARRY SET to the return if the driver was not
  3642.                              activated yet, using "Set_SCL"; otherwise the
  3643.                              registers are returned as indicated in the
  3644.                              paragraph I of STAR_REF.DOC.
  3645.                              Of course, it is also possible to issue an
  3646.                              "INT 14h" instead of a "call SCLservs" !
  3647.  
  3648.       The 3 "last" functions of the interrupt 14h incorporated to SCLIB.OBJ
  3649.     are disactivated because they only concern the DEVICE mode of STARCOMM.
  3650.     So, 2Ah and 2Ch will always return an error code 1 (i.e. "under-function
  3651.     unknown" !) and 2Bh will always return a code 13 (i.e. "driver not loaded
  3652.     as a DEVICE DRIVER !").
  3653.       The simple application named DEMO_LIB.ASM shows how to achieve this
  3654.     exploitation of SCLIB.OBJ.
  3655.  
  3656.                                                                        61
  3657.  
  3658.  
  3659.  
  3660.  
  3661.  
  3662.                  ANNEX:  Management of the differents hand-shakings
  3663.  
  3664.  
  3665.  
  3666.  
  3667.  
  3668.       ╔═══════════════════════════════════════════════════════════════╗
  3669.       ║ ATTENTION ---> At all events, the OUT2 signal of the used     ║
  3670.       ║ controller must be set to TRUE. In the contrary case, the UART║
  3671.       ║ has no more the material possibility of giving out its IRQ to ║
  3672.       ║ the processor (via the 8259 interrupt controller of course !).║
  3673.       ║    THEREFORE: DO NOT MODIFY THE OUT2 SIGNAL IN ANY CASE ! ! ! ║
  3674.       ╚═══════════════════════════════════════════════════════════════╝
  3675.  
  3676.  
  3677.  
  3678.     1- Managements integrated the serial driver:
  3679.     ────────────────────────────────────────────
  3680.  
  3681.       The SERIAL PORTS MANAGER's STARCOMM.EXE driver knows the management of
  3682.     Xon/Xoff (software hand-shaking), RTS/CTS and DTR/DSR (hardware
  3683.     hand-shaking). These 3 pairs of flow management signals (which can be
  3684.     set by using the options /BX, /BC and /BD, or by the call to the
  3685.     appropriates services), are managed as follows:
  3686.  
  3687.         ■ Xon/Xoff: When the receipt buffer doesn't contain more than a 100
  3688.         bytes free (or less...), all received byte provokes the transmit of an
  3689.         Xoff code (= 13h). As soon as more than 2/3 of the receipt buffer are
  3690.         all over free again, there is transmit of an Xon code (= 11h) to every
  3691.         reading from the consumer in this receipt buffer; this to competition
  3692.         of 10 Xon consecutively sent (i.e. sent without any Xoff being sent
  3693.         back between them because the receipt buffer was found "full" again !).
  3694.         An Xon is also sent each time the receipt buffer is emptied due to
  3695.         an order from a local user program.
  3696.         For security (case of a communication error occurring on the Xon
  3697.         code !...), STARCOMM.EXE considers it receives an Xon code following
  3698.         each "error in receipt" interrupt generated by the UART.
  3699.         REM: ACK/ETX (or all other pair !) can in fact be managed under
  3700.         covering of Xon/Xoff using the possibility offered to specify the
  3701.         hexa. values of Xon and Xoff !
  3702.  
  3703.         ■ RTS/CTS: The management logic of this pair is identical to the one
  3704.         of Xon/Xoff. Merely, "Send of an Xon (/resp. Xoff)" becomes "RTS is
  3705.         set to TRUE (/resp. to FALSE)"; and "the transmit doesn't take place
  3706.         that if Xon is the last code received among the Xon and Xoff codes"
  3707.         becomes "the transmit doesn't take place that if the CTS signal is
  3708.         set to TRUE" !
  3709.         REM: Whether this protocol is used or not, the RTS local signal is
  3710.         always initialized to TRUE at the same time as the concerned port is
  3711.         opened, and it is set to FALSE when the port is closed (whether it is
  3712.         explicitly concerning a port opening or a port closing, or only the
  3713.         change of the only used port !).
  3714.  
  3715.                                                                        62
  3716.  
  3717.  
  3718.  
  3719.  
  3720.  
  3721.         ■ DTR/DSR: Used as flow management signals, they are managed like the
  3722.         RTS/CTS pair (see above...).
  3723.         ATTENTION: DTR is also exploited by the device command transmit
  3724.         function, by the functions of opening and closing of a physical port
  3725.         (DTR is activated to the opening and disactivated to the closing), by
  3726.         the "change serial port in use" function, and by the treatment of the
  3727.         communication errors installed under the hardware interrupt of the
  3728.         associate UART to the serial port exploited. Therefore: once the port
  3729.         to exploit is open, do initialize DTR/DSR, and avoid using the transmit
  3730.         commands function in its "control via DTR" mode. But note this
  3731.         function is not a 100% incompatible with the DTR/DSR hand-shaking
  3732.         since it sets off the DTR to send its specified command, then it
  3733.         re-establishes DTR once the command send is achieved (without
  3734.         nevertheless verifying that the receipt buffer has any more room...).
  3735.  
  3736.         It is important to note that these hand-shaking can also be actived
  3737.     in one-sided mode (ascending or descendant) to the means of the following
  3738.     command-lines: "/LC", "/EC", "/LD", "/ED", "/LX", and "/EX"...
  3739.  
  3740.         ■ RI, DCD and OUT1: These signals can also be managed by STARCOMM.
  3741.         RI and DCD (input signals) are managed like CTS and/or DSR, whereas
  3742.         OUT1 (output signal) is managed like RTS and/or DTR.
  3743.  
  3744.       Finally, notes that the hardware hand-shakings (RTS/CTS, DTR/DSR, RI...)
  3745.     have full priority on the software hand-shaking: if, as an example,
  3746.     RTS/CTS is used and that CTS=FALSE, it becomes impossible for Xon/Xoff to
  3747.     send any control code, even though this software protocol is effectively
  3748.     active !
  3749.  
  3750.       In order to establish a hardware hand-shaking (with STARCOMM) that is
  3751.     fully personal to you only, report in 3 below.
  3752.  
  3753.  
  3754.  
  3755.     2- PC-PC local link and hand-shaking:
  3756.     ────────────────────────────────────-
  3757.  
  3758.                  ┌──────────┐          ┌──────────┐
  3759.                  │         2├───── ┌───┤3         │
  3760.                  │  PC #1  3├──────┘───┤2  PC #2  │
  3761.                  │         7├──────────┤7         │
  3762.                  └──────────┘..........└──────────┘
  3763.                     ?? hand-shaking control ??
  3764.  
  3765.       Among the embedded protocols, only Xon/Xoff is usable to this whichever
  3766.     is the express nature of your null modem serial cable. If you dispose of
  3767.     a more complete null-modem cable (Cf. A), you could exploit one of the two
  3768.     RTS/CTS and DTR/DSR hardware hand-shaking, or even these 2 at the same
  3769.     time (even though, in theory, the utilite of it is very questionable !...).
  3770.       If you want to create your own hand-shaking using to RTS, CTS, DTR,
  3771.     DSR, RI, DCD, and/or OUT1 signals, report in paragraph 3 below...
  3772.  
  3773.                                                                        63
  3774.  
  3775.  
  3776.  
  3777.  
  3778.  
  3779.     3- Personal exploitation of a hardware hand-shaking:
  3780.     ───────────────────────────────────────────────────-
  3781.  
  3782.       As explained in the paragraph 1- above, STARCOMM knows how to use the
  3783.     output signals RTS, DTR and OUT1 as well as the input signals CTS, DSR,
  3784.     RI and DCD in order to establish a hardware hand-shaking. The hand-
  3785.     shakings based on the RTS/CTS and DTR/DSR pairs, very classicals, are easy
  3786.     to implement using the driver functions calls 21h and 22h. However, it
  3787.     remains possible to define any signals pairs combining based on these 7
  3788.     different controls signals in order to implement a hardware hand-shaking
  3789.     adapted to your own needs (associated to your own developed application !).
  3790.       This need could result of the particular working of a device with
  3791.     which to converse, or of the will to develop a protecting for your own
  3792.     work thanks to a cable specially designed for your program.
  3793.  
  3794.       FOR EXAMPLE, supposes that your application must not function except with
  3795.     a special cable well stocked with the merchandised program. You decided the
  3796.     following diagram for your cable (that is an oriented cable, i.e. NOT
  3797.     symmetrical, for the interest of the example...):
  3798.  
  3799.                    MASTER UNIT         SLAVED UNIT
  3800.                         TX     ------>     RX
  3801.                         RX     <-----      TX
  3802.                        Gnd     -------     Gnd
  3803.                        OUT1    ------>     DSR
  3804.                        DSR     <-----      OUT1
  3805.          Couple OUT1/DSR assigned a hardware bilateral flow control.
  3806.                        RTS     ------>     CTS
  3807.          Couple RTS/CTS one-sided (remote of the main station only !).
  3808.  
  3809.       On the MASTER UNIT, your application will activate (function 22h):
  3810.     - the utilization of OUT1 (it has the DISTANT status inevitably...),
  3811.     - the DTR/DSR protocol in LOCAL mode so that only DSR is used,
  3812.     - the RTS/CTS protocol in DISTANT mode so that only RTS is used.
  3813.       On the SLAVED UNIT, your application will activate, in addition of the
  3814.     2 first signals indicated for the main station (symbolized by "..."):
  3815.     - ...
  3816.     - the RTS/CTS protocol in LOCAL mode so that only CTS is acknowledged.
  3817.  
  3818.       The signals OUT1, DSR and RTS-->CTS will then be dynamically used by
  3819.     the serial driver in order to inform the master and slave stations of the
  3820.     transmission possibilities resulting from the receive and transmit buffers
  3821.     states: The slave won't send any more data to the master but if DSR
  3822.     AND CTS are active, and the master won't communicate with the slave but
  3823.     if DSR is active (on its side).
  3824.  
  3825.  
  3826.         REMARK: It is also possible to use all or part of these signals,
  3827.     under STARCOMM, as if there were "STROBES", that is to say as
  3828.     identification signals statically set by the application. It is then
  3829.     sufficient to directly order the signals status as needed, and in taking
  3830.     carefulness of not using a same signal at the same time as a strobe AND
  3831.     as a flow manager ! (Recall: the function 20h, explained in page 19,
  3832.     permits to control the status of all these signals).
  3833.